Questions tagged [csom]

CSOM (Client Side Object Model) is a web services-based API of SharePoint allowing easy remote access to data and SharePoint's functions.

CSOM, which stands for Client-Side Object Model, is a web services-based API of SharePoint. It allows access to SharePoint data and features from remote clients. CSOM was introduced in SharePoint 2010 and greatly enhanced in SharePoint 2013.

Both JavaScript and .NET bindings to CSOM exist. Software leveraging CSOM can integrate with SharePoint without the need to run within a SharePoint farm.

In SharePoint 2013 CSOM is the only API available to software built using the new Apps for SharePoint architecture. Apps for SharePoint run side-by-side, typically in the cloud, and integrate with both cloud and on-premise SharePoint farms.

Corresponding MSDN documentation is located here, with separate JavaScript and .NET API references. The web services-based API underlying CSOM has been documented as part of Microsoft's Open Specifications initiative.

941 questions
5
votes
2 answers

Moving a SharePoint folder and contents to different location in same Document Library

I'm looking for a way to move a folder and all it's contents to a different location in the same library using the Client Object Model for SharePoint 2010 (C#). For example we have a folder for a project (say 12345) and it's URL is…
ebooyens
  • 608
  • 3
  • 9
  • 21
5
votes
1 answer

How to do Multi-factor authentication with SharePoint-Online using CSOM

Using just a password-based authentication, it's easy to authenticate in CSOM: context.Credentials = new SharePointOnlineCredentials(username, password); But how to authenticate when Multi-factor authentication is in place…
Edwin
  • 527
  • 7
  • 15
5
votes
2 answers

The proper way to write a SharePoint User to a User Field in a SharePoint list

I'm writing a user to a SharePoint list. I've read that the SharePoint User field has a string like this inside of it: userId;#userLoginName I've tried formatting in the same way when writing to a User field, for example when I write this string it…
Ectropy
  • 1,533
  • 4
  • 20
  • 37
4
votes
2 answers

Alternative Save/OpenBinaryDirect methods for CSOM for SharePoint Online

Based on the doc from MS https://learn.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…
10031103
  • 83
  • 1
  • 7
4
votes
1 answer

Download a specific file from SharePoint (CSOM) using C#

I'm developing a C# based application that requires to download, checkout, upload, check in on a specific file from/to Sharepoint with CSOM. So I have two questions here: Firstly, on download, is there others way to download a specific named file…
johny
  • 65
  • 1
  • 1
  • 5
4
votes
1 answer

Uploading a single Sharepoint document with metadata

I defined terms in the Term Store Management Tool which I added as "Managed Metadata" columns in a document library. I want to upload a document and to update its "Managed Metadata" columns. In order to do so, I wrote the following code: void…
japks
  • 43
  • 1
  • 3
  • 8
4
votes
3 answers

How to logout from Sharepoint with CSOM

I am using CSOM library with C# to upload some files to SharePoint. One requirement is to use 2FA. Basically, I am following this…
caldicot
  • 195
  • 2
  • 15
4
votes
1 answer

C# CSOM Sharepoint Bearer request from azure active directory

I am using the following approach as the basis of this (https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-devquickstarts-webapi-dotnet). I got all this example working after setting up azure. But now we need to port…
Andrew
  • 2,571
  • 2
  • 31
  • 56
4
votes
1 answer

What is exactly ClientRuntimeContext.Load Method doing

I am new in CSOM SharePoint and I was wondering if anyone could explain the differences between ClientRuntimeContext.Load and ClientRuntimeContext.ExecuteQuery and when I should use any of them?
Mugurel
  • 198
  • 10
4
votes
1 answer

Sharepoint.Utility replacements

I have been using different Sharepoint.Client nuget packages because of different framework targets and I am unable to find any resource describing the differences between them. But more importantly some are missing SPUtility class. Seems like a…
Thor
  • 498
  • 1
  • 6
  • 15
4
votes
2 answers

Fatest way to check and create folder in document library within SharePoint Online (CSOM)?

I have a SharePoint Online where I can connect through my console application successfully: private static ClientContext GetUserContext() { var o365SecurePassword = new SecureString(); foreach (char c in o365Password) { …
STORM
  • 4,005
  • 11
  • 49
  • 98
4
votes
2 answers

The collection has not been initialized

I am trying to retrieve all items from a Sharepoint library with CSOM and create a list of it. I am sure it has something to do with the order of the code. The question is how? ListItemCollection collListItem = oList.GetItems(camlQuery); var newList…
Citizen SP
  • 1,411
  • 7
  • 36
  • 68
4
votes
2 answers

Create field in SharePoint programmatically using CSOM (Not with XML)

Is it possible to create fields in SharePoint with CSOM, not using XML? I've seen many examples using XML, but none with just setting properties for the field programmatically? fields.Add(new **FieldCreationInformation** { InternalName =…
Robin
  • 740
  • 3
  • 12
  • 30
4
votes
2 answers

SharePoint/GetVersionCollection - how to identity which version?

I need to be able to query old field values from items in a SharePoint list. I can't execute code on the server (it needs to work with SharePoint Online/O365 for a start). So far the ONLY API I've that lets me do this is the lists.asmx…
Dylan Nicholson
  • 1,235
  • 14
  • 20
4
votes
1 answer

Get all the users based on a specific permission using CSOM in SharePoint 2013

I want to get the list of all the users who have a particular role/permission on a site. For example, I need the list of users who have edit rights (RoleType=Editor) using .Net CSOM in SharePoint 2013. They can be in any group. I tried many things.…
1 2
3
62 63