Questions tagged [csom]

The client-side object model (CSOM) provides access to a subset of the SharePoint Foundation server object model, including core objects such as site collections, sites, lists, and list items and allows you to program against these from client side applications.

Filter by
Sorted by
Tagged with
0
votes
1answer
17 views

Unauthorized when trying to call Sharepoint 2016 from ASP.NET

I have a piece of code that uses CSOM to get search results from Sharepoint. using (var clientContext = new ClientContext(serverUrl) { Credentials = CredentialCache.DefaultCredentials }) { ...
0
votes
1answer
23 views

ExecuteQuery() Vs Load() Vs Update()

I have the following code to retrieve a list item and then to update it. camlQuery.ViewXml = string.Format("<View Scope=\"RecursiveAll\"><Query><Where><Eq><FieldRef Name='...
0
votes
0answers
9 views

Display a specific list view using JSOM

Below is the code that I've currently got. I can not figure out how to add in the list view properly. I've added in var views = list.get_views("view name"); but every time I do, I get a blank page. ...
0
votes
0answers
16 views

SharePoint online Throttling issue

Recently I faced throttling issue and based on below article we should decorate request with User Agent https://docs.microsoft.com/en-us/sharepoint/dev/general-development/how-to-avoid-getting-...
0
votes
0answers
13 views

SharePoint 2016: Find all values of a site column across all sites in CSOM

I am trying to create a list of all the values that are being used for the site column "Classification" across all sites of a site collection. The idea is to build a dictionary to add to the term ...
-1
votes
0answers
25 views

Create Empty TaxonomyFieldValueCollection will raise “The collection has not been initialized. It has not been requested ..”

I have the following code inside my SharePoint remote event receiver:- camlQuery.ViewXml = string.Format("<View Scope=\"RecursiveAll\"><Query><Where><Eq><FieldRef Name='ID' ...
0
votes
1answer
18 views

Querying document library (which contain more than 5,000 documents) using FolderServerRelativeUrl will raise error “exceeds the list view threshold”

I have a document library which contain 6,000 ++ items, and i wrote the following code inside a remote event receiver to get the documents which are inside certain folder using FolderServerRelativeUrl,...
0
votes
1answer
8 views

Update an ExtendedProperties or Approval Comments of Sharepoint task item

I am trying to update a SharePoint task programmatically using CSOM. I am able to approve a task successfully but not sure how to update the comments. The comments could be retrieved using ...
1
vote
0answers
55 views

CSOM - Get ClientContext current/pending request query size (no file)

In C#, when executing ClientContext.ExecuteQuery(), if the query sent to SharePoint has a size above 2MB, it returns an error like this: The request message is too big. The server does not allow ...
0
votes
0answers
22 views

Powershell Convertto-HTML from list items also outputs raw objects before the actual HTML

I am writing a Powershell Script to read SPListItems, create a PSObject for each, add it to the PS Array and after the loop ends I use the following to convertto-html myArray | convertto-html -path .....
0
votes
0answers
26 views

How to use CSOM for Sharepoint 2013 to check if a user is member of a SP group through an AD group?

Im trying to figure out using .NET CSOM if a specific user is a member of a SP group through an AD group. Currently we have the following code running, but if a user is added to an SP group using an ...
0
votes
0answers
19 views

When set value of multiple user field of an office file in document library using CSOM, only values in odd positions can be saved

When I use CSOM to update a multiple value field of an office file in a document library, only values in odd position can be saved. You can see in the below picture: The code that I used is quite ...
0
votes
0answers
18 views

Hover Panel - Delete Document in SharePoint Search

I have added a delete document button on the hover panel within the footer and that works ok , no problems. I then need to execute some JSOM, so when the button is pressed and delete file JSOM is ...
2
votes
1answer
19 views

Lists.GetByTitle(SPlist) - title differs depending on language

When I ask for the list collection on a sharepoint site by Dim collList As ListCollection = Web.Lists ctx.Load(collList) ctx.ExecuteQuery() the list "Documenten" appears in the list. ...
2
votes
1answer
26 views

Add a document to a library without triggering webhook using Csom

We have a library in SharePointOnline with a webhook. Normally we want the webhook to fire when a document is altered, but sometimes it is required not the fire the webhook. In Sharepoint Onprem we ...
0
votes
0answers
25 views

How to create clientcontext object in class library?

In my solution I have 2 projects. First Project is .Net Standard 2.0 second one is .net framework (class library). From .net standard application I am executing CSOM code and it is executing ...
0
votes
1answer
23 views

How i can get an Active Directory mail-enabled security group using CSOM

I am working on a remote event receiver, and i want to reference a mail-enabled security group using the email, i tried this:- context.Load(context.Web.SiteUsers); context.ExecuteQuery(); User ...
3
votes
1answer
58 views

Reference/Update the current item inside ItemAdded/ing and ItemUpdated/ing remote event receivers, is it available inside the SPRemoteEventProperties

I am working on remote event receivers, and let say I want to update a field named ProjectID inside my ItemAdded, currently, I am executing a CAML query to get the current item >> update the ProjectID,...
0
votes
0answers
16 views

Sharepoint giving 401 unauthorized error instead for 404 file not found for a site that doesnt exists using CSOM

I have created an azure function which gets the site name from the end user and uses CSOM code to get the owners of a sharpoint online site collection using service account credentials. Now there are ...
0
votes
1answer
29 views

ExecuteQuery will return this error “Item does not exists it might be deleted by another user” on existing item

I am working on remote event receiver, and i have this code:- Folder folder0 = context.Web.GetFolderByServerRelativeUrl(context.Web.ServerRelativeUrl + "/library3/" + currentFilingSystemItem["...
1
vote
2answers
32 views

What is the simplest way to get all sub-folder and files inside a Folder using CSOM

I have the following code to get the sub-folders and files inside a folder, but this code will not retrieve any sub-folder and files found at deeper level. so can anyone advice how i can get all the ...
0
votes
1answer
16 views

Unable to change the managed metadata fields for my Files and Folders inside my remote event receiver

I have the following code inside my RER:- foreach (ListItem currentFilingSystemItem in collListItem) { Folder folder = context.Web.GetFolderByServerRelativeUrl(context.Web.ServerRelativeUrl + "/...
1
vote
0answers
13 views

Folder.MoveTo will reset the main folder fields. can i preserve them

I am working on a remote event receiver inside SharePoint online, and i have a code to move a folder to another library. now the source and destination libraries have the same content type and each ...
2
votes
2answers
21 views

Unable to modifiy the Folder custom column inside my CSOM

I have the following code inside my CSOM:- Folder folder = context.Web.GetFolderByServerRelativeUrl(context.Web.ServerRelativeUrl + "/library3/" + currentFilingSystemItem["DealName"].ToString()); ...
0
votes
0answers
9 views

Unable to get the “vti_filesize” for our document library items inside our sharepoint online remote event recevier

I am working on developing a remote event receiver for an online document library inside a communication site collection. and inside the ItemDeleting RER, i want to check if the item that is going to ...
1
vote
1answer
31 views

The given value for a taxonomy field was not formatted in the required <int>;#<label>|<guid> format

I have the following code to set the column default values for a library:- var corpTypetaxValue = listItem["CorpType"] as TaxonomyFieldValueCollection; var corpTypeFieldValueArray = corpTypetaxValue....
0
votes
1answer
31 views

The type 'SPFolder' is defined in an assembly that is not referenced. You must add a reference to assembly

I am working on building a remote event receiver, and i added the following nuget package Install-Package Microsoft.Office.DocumentManagement -Version 15.0.0. Then on this line of code:- ...
0
votes
0answers
31 views

Project CSOM 'User:<customercontent></customercontent> not found in Active directory or in project db.'

I am trying to access the Project Online CSOM without using an authenticated user. I want to use a process similar to below: https://bamrotiya.blogspot.com/2018/08/csom-authentication-without-...
0
votes
1answer
20 views

Unable to get Security groups inside my CSOM “Group Not Found”

I have a site column of type People/Group named "SecurityGroups" which contain security groups. now i want to get those security groups and add them to our Folder permission. tried the following code:-...
0
votes
0answers
13 views

change from sharepoint 10 to sharepoint online

We developed .Net component which runs on a windows server and writes to Sharepoint 10. We need to change it to write files to Sharepoint Online. Before we were using Microsoft.Sharepoint.Client.dll ...
0
votes
0answers
20 views

Configure the “Column default value settings” inside our remote event reicever. is this possible

Inside any document library we can set the "Column default value settings", as follow:- but i am working on a remote event receiver, where i created a root folder, as follow:- ...
1
vote
0answers
20 views

CAML query for child properties

I have a CSOM query like this one: _context.Load(currentItems, lis => lis.Include( i => i.RoleAssignments.Include( ra => ra.RoleDefinitionBindings, ...
0
votes
1answer
16 views

Unable to add Sub-Folders using CSOM

I have the following code to create a root folder and sub-folders inside my remote event receiver:- foreach (ListItem i2 in collListItem2) { var templatenumber = isDeal ? "10" ...
0
votes
1answer
23 views

CSOM. check if a folder exsists before trying to add it [duplicate]

I have the followoing code to create a folder inside a document library:- ListItemCreationInformation listItemCreationInformation2 = new ListItemCreationInformation(); // Below are options. ...
0
votes
1answer
11 views

Error “Cannot add a role assignment with empty role definition binding collection`” when i try to grant folders unique permission

I have the following code inside my remote event receiver to grant a folder unique permissions:- RoleDefinition readerDef = context.Web.RoleDefinitions.GetByType(RoleType.Reader); ...
0
votes
1answer
37 views

How i can break the item permission for a list item and assign all the Groups Read permission level

I am working on a Remote Event Receiver, and i want to do the following:- Break item permission + copy the permission. For all the SharePoint groups assigned to a list item >> grant them Read ...
1
vote
2answers
39 views

How i can update a managed metadata column with multiple values using CSOM

I have the following code inside my remote event reciever, to create a new folder, and then populate the folder managed metadata fields with the current item (item that was added) values:- ListItem ...
2
votes
1answer
32 views

I want to get list where invoice _category is service please help? [closed]

I want to get the list items where invoice _category is equal to "Service". Please help? Current code: camelQuery.Viewxml = "<View><Query> <Where><Eq><FieldRef Name='...
0
votes
0answers
21 views

Connecting web parts through Javascript in SharePoint 2013

I am working in SharePoint 2013, and I have two OOTB web parts (list view & URL filter) that I want to connect programmatically. I also want this to be a client-side solution with JavaScript, ...
2
votes
0answers
40 views

SharePoint provider hosted add in throwing 401 error on execute query

We have a provider hosted app used by many customers in SharePoint Online, but there is this one new customer who is getting this error whenever he tries to launch the app after installation. ...
1
vote
1answer
18 views

Get all onedrives from c#

I am looking for a c# snippet for getting all OneDrive's. There is a lot of sample for PowerShell, but I am looking for c# snippet that can provide all OneDrives in a tenant.
0
votes
1answer
22 views

Copy list items from multiple source lists to a single target list

I have been given a task to make a script in CSOM. I am very new to Powershell so any help would be appreciated. I have a site collection with multiple calendars within the sites. I have to create a ...
0
votes
1answer
24 views

Is it possible to Post a Message to Teams Conversation using the SharePoint ClientContext?

I was successfully able to add a File in the Files tab of Teams, using the SharePoint.Client.ClientContext But I could not find any documentation on posting a message using the clientContext. Any ...
1
vote
1answer
16 views

Reply to a topic in Discussion board List using CSOM

I am working with a Discussion board list. I need to create the whole list using CSOM from scratch. To which I was able to make the list and topic inside it as folders. But I am not able to add ...
0
votes
0answers
19 views

Configure Connections of Query String URL Filter web part programmatically

I am trying to configure the connections of the query string url filter web part with JSOM. The connections do not seem to be stored in the web part's properties, so I am at a loss as for how I can ...
0
votes
0answers
34 views

'Permission access denied or don't have access' issue in sharepoint webhook

I am new to sharepoint webhooks and was referring this official site and this pnp sample documents to get notification detail. I had successfully got notification hit in my Web application after any ...
1
vote
0answers
58 views

How to set Retention label to SharePoint Document using CSOM?

I am trying to set the retention label (i.e. Office 365 admin under Security & Compliance center) to a file in a SharePoint Online Document Library using CSOM. I can set the Retention Label using ...
2
votes
1answer
31 views

How to get “Allowed Content Types” of a DocumentSet by CSOM on SPO?

I have a SPO site with some DocumentSets having different ContentType. I need to get "Allowed Content Types" of any DocumentSet to take a decision: I get my DocumentSet as ListItem or as Folder or as ...
1
vote
0answers
25 views

How to detect user sign out in sharepoint Provider Hosted App

I want to detect when user logout from SharePoint site to SharePoint add-in. Now I'm getting current user using this code: var user = clientContext.Web.CurrentUser; clientContext.Load(user); await ...
0
votes
2answers
399 views

The sign-in name or password does not match one in the Microsoft account system

When connecting to online site we have Microsoft authentication call to our phones and we will enter our pin for authenticating.Then only we can access the site. But in csom code when conencting to ...

1
2 3 4 5
35