csom

How to delete SharePoint Site Collection using pnp csom programmatically

蓝咒 提交于 2021-02-11 14:24:07
问题 I have a requirement on SharePoint Online Office 365. As per my requirement, I have to delete all the Site Collection from SharePoint Online Office 365 Admin Center using pnp csom programmatically. Anyone can suggest that how can I delete all the Site Collection? 回答1: You can use DeleteSiteCollection extension method to remove the site collection. It can be used as below: string userName = "admin@tenant.onmicrosoft.com"; string password = "password"; string siteUrl = "https://tenant-admin

How to get document preview image using SharePoint CSOM

孤者浪人 提交于 2021-02-10 12:37:28
问题 I would like to programmatically retrieve thumbnails of documents from SharePoint. What I'm trying to do is the following: document.GetImagePreviewUrl(width, height, clientType); This just returns an empty ClientResult . I am not sure what to enter as clientType value. I have also tried to use this method programmatically (by using WebClient and downloading the file). But that just returns a 403 response. The possible solutions I see here are the following: Figure out what to enter as

How to get document preview image using SharePoint CSOM

ぃ、小莉子 提交于 2021-02-10 12:34:07
问题 I would like to programmatically retrieve thumbnails of documents from SharePoint. What I'm trying to do is the following: document.GetImagePreviewUrl(width, height, clientType); This just returns an empty ClientResult . I am not sure what to enter as clientType value. I have also tried to use this method programmatically (by using WebClient and downloading the file). But that just returns a 403 response. The possible solutions I see here are the following: Figure out what to enter as

Alternative Save/OpenBinaryDirect methods for CSOM for SharePoint Online

谁说胖子不能爱 提交于 2021-01-29 14:31:23
问题 Based on the doc from MS https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/using-csom-for-dotnet-standard, Save/OpenBinaryDirect methods is not available for .NET core app, they suggest to use regular file API, so what is the alternative way to read/write files stored in SharePoint online? what is the regular file API? does anyone done this? any example code/documentation? 回答1: Download file in .NET Core CSOM: using (var authenticationManager = new AuthenticationManager()) using (var

Why do i have error on SharePointOnlineCredentials ? namespace not found

≯℡__Kan透↙ 提交于 2021-01-07 02:44:26
问题 I have CSOM packaged installed as you can see: And i cannot install sharepoint package or runtime because it says its not compatible with my version 3.1 ... So this is a repeated question, but the thing is i cant comment and in any other post people tell us to install all this packages i talked before... How can i use SharePointOnlineCredentials? Thanks for any help 回答1: SharePointOnlineCredentail isn't supported in .NET Standard platform any more. Please check the official document here for

Why do i have error on SharePointOnlineCredentials ? namespace not found

帅比萌擦擦* 提交于 2021-01-07 02:43:21
问题 I have CSOM packaged installed as you can see: And i cannot install sharepoint package or runtime because it says its not compatible with my version 3.1 ... So this is a repeated question, but the thing is i cant comment and in any other post people tell us to install all this packages i talked before... How can i use SharePointOnlineCredentials? Thanks for any help 回答1: SharePointOnlineCredentail isn't supported in .NET Standard platform any more. Please check the official document here for

unable to parse a string of this format “1/29/2020 12:00:00 AM” into a valid DateTime

ぃ、小莉子 提交于 2020-03-30 18:00:12
问题 I am working on a SVC service, and when I run it locally I get the Date field as follow 30/01/2020 00:00:00 and I parse this string to be a DateTime as follow (DateTime.ParseExact(i["ProjectLastUpdate"].ToString(), "dd/MM/yyyy hh:mm:ss", CultureInfo.InvariantCulture).ToString("yyyy'-'MM'-'dd'T'00':'00':'00'Z'")) , since my local machine uses the United Kingdom regional setting. But when I host the service inside an Azure Web App, I start receiving the date string as follows: 1/29/2020 12:00

Get count of all the subsites (all levels) in all site collections in SharePoint Online using PowerShell

筅森魡賤 提交于 2020-03-05 05:08:24
问题 I'm trying to get all site collections and respective subsites at all levels within the site collection using PowerShell. There are so many posts and references which outline the way but I could not find a post which can provide the count of subsites (all levels again) in a site collection. My environment is SharePoint Online. I need two things: Get the count of all subsites in all site collections in SharePoint Online and export to CSV. Export the list of site collections and subsites in the

What is wrong with this caml query to get exception “can not complete this action. Please try again”?

杀马特。学长 韩版系。学妹 提交于 2020-03-05 01:30:44
问题 I am implementing a caml query on a SharePoint list! I have 5 conditions and I place every 2 condition in one tag. but It is still get this exception: "can not complete this action. please try again!" <And> <Eq> <FieldRef Name='fieldName1' /> <Value Type='Text' >value1</Value> </Eq> <And> <Contains> <FieldRef Name='fieldName2' /> <Value Type='Text' >value2</Value> </Contains> <Contains> <FieldRef Name='fieldName3' /> <Value Type='Text' >value3</Value> </Contains> </And> <And> <Eq> <FieldRef

Create CSOM ClientContext with re-usability like singleton pattern

Deadly 提交于 2020-02-29 06:45:04
问题 The bounty expires in 4 days . Answers to this question are eligible for a +50 reputation bounty. Amna wants to draw more attention to this question: I need the accurate answer which will highlight how can making a static ClientContext object for reusability can affect? and what is the expiry of this context as when it is required to be refreshed? I have multiple methods being called on different user actions which is using ClientContext . Creating it on every method execution was causing