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
0answers
26 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
21 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
19 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
22 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
38 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
30 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
35 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
60 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
23 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
44 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
18 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
22 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
11 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
80 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
38 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
46 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
24 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
14 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
21 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
23 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
31 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
19 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
38 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
88 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
25 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
57 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
29 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
29 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
24 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
21 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
43 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
90 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
34 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
31 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
2k 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 ...
0
votes
1answer
53 views

SharePoint Online - CSOM API requests for getting site metadata fails when permissions are properly set

I've got an interesting permissions problem with the CSOM API. We have about 200 site collections. I have created a Permission Level on each site collection, and have assigned a Service Account AD ...
2
votes
3answers
260 views

Fastest way to create multiple list items (around 2000 items) into a list using C#/CSOM

Somebody please suggest me the fastest way to add multiple items into a SharePoint list. My current c#/csom code is taking too much time in populating the list. And I have to do this activity every ...
0
votes
2answers
63 views

Remove unique permission on list item

I have run the csom code for break inheritance and set the unique permission on list item (ex.contribute). when user modified the list item, i want to the remove that unique permission and set other ...
0
votes
1answer
29 views

AllowMultipleValues in taxonomy field in CSOM Javascript

I am trying to create a taxonomy column within JSOM , I am nearly there but I have set the type to : var fieldSchema = `<Field Type="TaxonomyFieldTypeMulti" Name="...
0
votes
1answer
53 views

Get files in same directory as Excel document via VSTO

I have a VSTO on Ms Excel/Word which checks the current location of the active document (Dim MyPath as String = Application.ActiveWorkbook.FullName), and then pulls the list of files located in the ...
0
votes
0answers
14 views

Read the user and permission from excel update in sharepoint site and group

I want to read the user name and the access from the excel sheet and update them in a list item level permission.
0
votes
1answer
39 views

Serialize and deserialize SharePoint CSOM objects

I want to serialize the objects of CSOM to JSON store them. Later nee to deserialize them. I know there is no direct way to do that it will give an error : "The property or field '----------' has ...
1
vote
1answer
232 views

CSOM C# Copy Library from one Site Collection to another with all folders / subfolders intact

Any help would be appreciated here. Below is my attempt to copy files and folders from one site collection to a completely different site collection. The structure from one side to the other should ...
0
votes
2answers
69 views

CollectionNotInitializedException

I slightly modified this example of how to use CSOM to display a list's current views. I'm getting the following error: "Microsoft.SharePoint.Client.CollectionNotInitializedException: 'The collection ...

1
2
3 4 5
35