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
10 views

File object created and modified property values vary from ListItemCollection and FileCollection

I noticed some differences in values when calling File obj Created and Modified properties from ListItemCollection and FileCollection. Details below: Below is some old code that fetched files from ...
0
votes
1answer
21 views

CSOM File object ID property

What is the correct way to initialize or call File obj ID property? I don't see it as a default object property. I also tried calling via: File.ListItemAllFields["ID"] That failed. I did ...
1
vote
0answers
21 views

Why does this code works? Calling executeQuery without Load [CSOM]

First question: Why we don't need ctx.Load(web) before defining the List? I see that we use web object in defining the List Second question: Why are we not calling ctx.Load() before ExecuteQuery ...
0
votes
0answers
15 views

CSOM - .Net Core 3.1 - Getting access denied from the last context.ExecuteQuery(); when trying to create a sub web

Everything else works perfectly. Why am I getting an access denied when trying to execute this code ? string password = "password"; var securePassword = new System....
0
votes
0answers
15 views

Copy file and return meta data

i want to ask how to make return meta data especially GUID after copy or move data via csom? im using MoveCopyUtil.MoveFile(this.clientcontext,srcUrl,DstUrl,true,options); i have source url as ...
0
votes
0answers
12 views

Check if content editor or script editor web part is present in the list forms (New/Display/Edit form) using PowerShell (CSOM/PnP)

I am trying to check if the content editor or script editor web part is present on the list forms (NewForm, EditForm, DisplayForm) in SharePoint 2013. I can get the web part type from web part page ...
0
votes
0answers
23 views

You cannot load dependent objects for more than 1000 resources. Use a filter to restrict your query

I have on-premise SharePoint 2019 and MS Sql Server 2019. I use CSOM to set actual work for resources. public TimePhase getResourceTimePhaseAssignments(EnterpriseResource resource, DateTime startDate, ...
0
votes
0answers
15 views

Trigger an update on documents

We would like to trigger an update documents so they will be included in labeling in the compliance center. Is there a minimum call you can make to trigger an update on a document without changing ...
0
votes
0answers
16 views

CSOM-Sharepoint online console app c# 'ServerVersion' threw an exception of type 'Microsoft.SharePoint.Client.PropertyOrFieldNotInitializedException'

I am developing a simple code to retrieve item from Sharepoint online List. But on debug, I found an exception is thrown saying ServerVersion 'ServerVersion' threw an exception of type 'Microsoft....
0
votes
0answers
25 views

ServerRedirectedURL has no value

Do you have any idea on what maybe the reason why I am getting empty string when using GetWOPIFrameUrl, also having null values on ServerRedirectedURL, ServerRedirectedEmbedURL, and ...
0
votes
0answers
18 views

Executing a CAML query will return this error: “Specified argument was out of the range of valid values. Parameter name: index”

I have the following code inside our console application, to loop through a list of number and query the SharePoint list which is inside a modern communication site: foreach (var r in allrequests....
0
votes
0answers
15 views

Microsoft.IdentityModel.SecurityTokenService.RequestFailedException: Token request failed

I have a .net console application which have this CSOM code:- using (ClientContext context = new PnP.Framework.AuthenticationManager().GetACSAppOnlyContext(RisksiteUrl, clientId, clientSecret, ...
0
votes
1answer
14 views

How to CheckOut, Update and CheckIn a new version of an existing Sharepoint Document in C#

I'm using C# CSOM to add documents to a Sharepoint library. I'm using the code below which works. How do I modify this code so that if the Document already exists in Sharepoint it will CheckOut the ...
0
votes
1answer
17 views

Get all content and child content inside a folder using sharepoint PNP framework

I can get all contents inside a SharePoint list like this: List list = oWebsite.Lists.GetByTitle("Documents"); ListItemCollection Items = list.GetItems(CamlQuery.CreateAllItemsQuery()); ...
0
votes
1answer
21 views

Bind a lookup field to a dropdown in Provider Hosted App SharePoint Online using CSOM/C#

I am trying to bind a lookup column named team to an asp.net dropdown and the dropdown renders blank HTML <asp:DropDownList ID="team" runat="server" AutoPostBack="true"...
0
votes
0answers
11 views

CSOM - ApplyProvisioningTemplate - Access denied. You do not have permission to perform this action or access this resource

I was using ApplyProvisioningTemplate function with PnP.Framework as below code for applying template . it used to work without an issue. but i randomly get the below error with following message . ...
0
votes
1answer
22 views

can any one provide complete script to compare csv file and SharePoint list column(People) and extract records not exist in SharePoint list

I have one excel file and a SharePoint list(Employee master). I want to extract the user in csv file who is not in the SharePoint list(Employee Master). If the employee not exists in SharePoint list ...
0
votes
1answer
23 views

How to find all subfolders inside a SharePoint Folder using PNP Framework

I want to find all the subfolders of a SharePoint folder using PNP framework. My current code is like this using (var cxt = new AuthenticationManager().GetACSAppOnlyContext(siteUrl, ...
0
votes
1answer
25 views

How i can secure ClientSecret for my app which i am using inside SharePoint asp.net console application

I have the following SharePoint asp.net console application, which runs each hour using windows tasks scheduler :- string clientId = "e***"; string clientSecret = "****"; string ...
1
vote
0answers
39 views

Working with large amounts of folders

I'm in SharePoint Online, where I have to copy data from one list to another. My code already works on low amount of folders, but I have problems with large amount of folders. Example: LibraryA: ...
0
votes
0answers
13 views

Is there GetFieldDefaults for class Microsoft.SharePoint.ClientDocumentManagement.MetadataDefaults

I am trying to retrieve the value after first setting a default for a field at a location using the method SetFieldDefault(SPFolder, String, String). The reason for this is we are finding that some of ...
1
vote
1answer
56 views

Azure Function - SharePoint CSOM call with currently signed in user

I have a azure function and making a CSOM call to SharePoint online. The authentication was done with App ClientId & ClientSecret. Everything working fine. I am capturing a DocSet version via CSOM ...
1
vote
1answer
22 views

How to fetch all the document libraries into a FolderCollection for SharePoint Online C#

I am trying to get the name of the document libraries of SharePoint online into a FolderCollection using the below code. But it looks like I am not getting the display name of "Documents" ...
0
votes
0answers
16 views

CSOM code to loop through all groups and users assigned inside an item and grant them Read permission

I have the following code to define a unique permission for a list item and iterate over all the groups and users assigned to the item, as follow:- ListItem listItem = context.Web.GetList(context.Web....
1
vote
1answer
32 views

SPO CSOM Powershell manage folders with # and % in the name

I'm writing a CSOM PS script to create folders in a doclib, and set permissions on them. Anything works fine except when the folder name contains a % I am able to create the folder using ResourcePath, ...
3
votes
0answers
76 views

I am no longer able to debug/run my SharePoint Remote Event Receiver locally using Ngrok

Last month the below steps were working well for me to debug and test a SharePoint online remote event receiver locally:- Open Ngrok.exe >> run the following command inside ngrok:- ngrok ...
1
vote
1answer
38 views

Upload a file in any specific subfolder of sharepoint online C# (CSOM)

I am trying to send a file (Test.docx) to a specific folder under document library in sharepoint online. The folder name is "new" which is under a "Test" folder i.e. Documents/Test/...
0
votes
1answer
42 views

How to get/update all user profiles via CSOM?

I need to get and update user profile properties in SharePoint Online via CSOM using App only permissions. I am using .NET core CSOM. App is registered via appinv.aspx page. Permissions: <...
0
votes
0answers
37 views

ClientContext gives 401 unauthorized for AccessToken from https://login.microsoftonline.com/{tennant_id}/oauth2/token

I'm using CSOM APP-only auntentication method to connect with SharePoint in a .Net Core Application using MicrosoftSharePointCSOM package and not PNP packages. Problem- I'm using below endpoints to ...
0
votes
1answer
24 views

Inside CSOM why I can populate a “People or Group” field using User object while I can not populate a “Managed Metadata” field using Term object

Inside my CSOM code, I can populate a "People or Group" field using User object, as follow:- var technician = context.Site.RootWeb.EnsureUser(SQLitem.Technician); context.ExecuteQuery(); ...
0
votes
0answers
21 views

Context.ExecuteQuery() will raise this error:- “System.NullReferenceException: 'Object reference not set to an instance of an object.”

I have the following CSOM code inside my asp.net core console application:- TaxonomySession txSession = TaxonomySession.GetTaxonomySession(context); TermStore tc = txSession.TermStores.GetByName(...
1
vote
0answers
21 views

GraphAPI send invitation to external/guest user for a specific SharePoint site

Language: JavaScript - MSAL library Scope: GraphAPI Is there a way to send an invitation to an external user thorough GraphAPI that will be valid only for a specific site. Currently I am using the ...
0
votes
1answer
32 views

Can we use CSOM inside .NET 5.0

I have created a new .NET 5.0 core console application >> but i am not sure if currently CSOM is supported inside .NET 5.0 ?
0
votes
1answer
28 views

Approaches to integrate our Service Desk system with SharePoint Lists

We have a Service Desk system and using its REST API and on other Scenarios using its Database we need to fetch data from the Service Desk system and populate SharePoint lists. so I am trying to find ...
0
votes
2answers
18 views

Operations on a ContentTypeCollection object throwing an unexpected exception

I am developing a Console application to programmatically download documents from a SP site among other things. I am trying to retrieve the fields of a content type of a SP list using CSOM : using (...
0
votes
0answers
30 views

CAML Query to filter out document sets based on values of Content Type

I have a document library with document sets that have Content Type (Name of Content Type is "FruitCategories") columns as "FruitName" (single line of text), "FruitPrice" ...
0
votes
1answer
40 views

Setting “Site sharing settings” programmatically

I am trying to programmatically set the "Site sharing settings" options under "Site Permissions" -> "Change how members can share" screen on a Modern site. I would ...
0
votes
1answer
48 views

SharePoint Online - Add site collection admin using CSOM PowerShell

I have one SharePoint site e.g. test1 - "https://abc.sharepoint.com/sites/test1". I have granted SharePoint Administrator role to User1 in the Microsoft 365 Admin Center (Note - User1 does ...
0
votes
0answers
37 views

How to block files from downloading and not allow editing in CSOM

I want to set all files in a specific folder to "block from download" and "disallow editing". Just a simple automated process so it saves me time having to manually set each and ...
0
votes
1answer
17 views

Getting all shared files and folders from a given site

Is it possible to get all files or folders that has been shared from a site in one batch, or do you need to iterate each single file and folder on the site?
0
votes
1answer
19 views

powershell query row limits for SharePoint online

I am not a super scripter, but I have a requirement run a search query over a site with multiple libraries. The query is for all documents where a specific string (someone's name) appears. I have 2 ...
0
votes
0answers
18 views

Adding LastItemUserModifiedDate to an array in Sharepoint Online

I am currently working on a script that will loop through every site with the site status "Unlock" and display the details of the last time the site was modified by a user. In the future I ...
0
votes
0answers
14 views

In CSOM how to remove values from FieldUserValue[] field

In CSOM how can I remove values from FieldUserValue[] field. Here is my current code: FieldUserValue[] finalApproverColl = (FieldUserValue[])ApprovalItem["FinalApprovers"]; if (ApprovalItem[...
0
votes
0answers
6 views

Add navigation link 'old school' to a Hub menu

I know how to do it with PnP, but I would like to do it wit classic CSOM. The Hub menu is not part of the Web.Navigation object, like the the QuickLaunch or the TopNavigationBar,
0
votes
0answers
27 views

Project Server - Updating notes on a task through REST/CSOM

I've been racking my brain over this for a while and Googling has failed me so I was hoping I could get some help here. I just want to be able to update the Notes field on a Project Task in Project ...
1
vote
0answers
22 views

Updating calculated field formula via CSOM with non-english regional settings fails with “The formula contains a syntax error or is not supported.”

In our current project we programmatically provision site collections, site columns and content types using CSOM/PnP. During this provisioning process the initial locale id is switched from 1033 to ...
0
votes
1answer
26 views

Can we disable remote event receiver from firing inside remote event receiver

I am writing a remote event receiver for our online custom list, and the RER itself do some updates to the item been added/updated, where this is causing my RER to keep firing. so is there a way when ...
0
votes
1answer
69 views

Adding security group via EnsureUser failed: 'The specified user could not be found'

target: SharePoint Online, Azure AD code environment: Azure Functions, .Net Core goal My goal is to ensure a user to a SharePoint site programmatically (via CSOM) and this user is a Security Group. ...
1
vote
1answer
27 views

Make a rest csom call - error in body

I'm using a flow http request and wish to update a sharepoint column with the following uri: _vti_bin/client.svc/ProcessQuery It all works , but when i try to add html tags, <a href="https://...
0
votes
0answers
24 views

SharePoint High Trust some users getting 401

Hi I've created a High Trust application, but some users seem to be getting the 401 from time to time. I've got a hunch that it's down to them not logging off and something not 100% accurate with ...

1
2 3 4 5
38