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
15
votes
2answers
3k views

Which one is faster CSOM or JSOM

Understanding which one has better performance for performing CRUD operation in SharePoint List, CSOM or JSOM?
15
votes
5answers
14k views

Add Document Library XsltListViewWebPart using CSOM or web services

How to add a document library XsltListViewWebPart (or list view web part) on page using CSOM with SP2013 when we do not want to use the in-built view with "Name, Modified, Modified By" fields? Custom ...
12
votes
3answers
5k views

Set request access email address through CSOM

In the server side object model it's possible to set the request access email address through the property SPWeb.RequestAccessEmail (MSDN). Since we are moving our SharePoint tenant to Office365 I'm ...
11
votes
1answer
200 views

Is it possible to load the parameters of a single object using LoadQuery()

I am working on a project where the ClientContext might be active for a long time. To prevent memory usage getting out of hand I would like to use ClientContext.LoadQuery() instead of ClientContext....
10
votes
1answer
19k views

Send Emails via SharePoint CSOM

I am trying to write a mailsender in C# for SharePoint but each time I start it I get this error message that tells me that it doesn't have permission. I had tried to give it permission at ...
10
votes
3answers
3k views

How to change 'Welcome Page' on the basis of logged in user or group?

I want to set respective page as welcome page to the logged in user or group, If user go to the site Url. e.g. https://siteurl/pages/Page1.aspx - for group A https://siteurl/pages/Page2.aspx - for ...
10
votes
1answer
709 views

Code editor (IDE) for CSOM developement - Sharepoint

I am searching for a code editor with which I can connect to SharePoint library, like I can open a complete library in the editor, edit, save changes, which will be reflected in the library. ...
10
votes
2answers
205 views

Correlate ChangeLog to a specific version

Goal: to be able to relate a ChangeItem from a Changelog to a version of that item. Issue: I can fetch metadata and version for a List Item. However, I am unable to relate a specific version of that ...
10
votes
4answers
3k views

SharePoint O365 upload big file via CSOM

I am tring to upload large files (900 MB) to SP Online (actually the OneDrive Business) but seems to follow SP style. Tried this via CSOM and powershell 70 MB are fine but when I try 900 MB a ...
9
votes
1answer
5k views

Create Modern Sites in SharePoint Online using CSOM

Can we create Modern Team site and Communication sites using CSOM in SharePoint Online ? I tried to create the modern site for GROUP#0 and SITEPAGEPUBLISHING#0 with the below code sample and ...
9
votes
1answer
10k views

Username argument is invalid in SharePointOnlineCredentials - CSOM

I wrote a simple code in CSOM to get web title. Hope code is fine. When I execute my application I got an exception from my third line (clientContext.Credentials = new SharePointOnlineCredentials("...
9
votes
1answer
16k views

JSOM - get listitem by file URL

Task Short - Access item attribute from a picture library by picture url. Long - When editing a pagelayout and an image is added to the page, the image's description should be loaded. This is ...
8
votes
8answers
47k views

SP.js file not loaded in a simple JSOM example

I am creating a simple example that demonstrates client object model using javascript. I have ceated a simple JS file in Visual Studio and an aspx page using the SharePoint Designer. I have used ...
8
votes
2answers
3k views

Recovering a file from the recycle bin

I'm working on a general function to recover an item programatically from a recycle bin via Powershell and CSOM. This is what I have so far, it doesn't throw an error, but it doesn't recover the file ...
8
votes
2answers
3k views

create custom permission level in SharePoint Site programatically in JSOM or CSOM

I want to create my custom permission level programmatically name "Only Doc Edit" and want to choose only selected value for them viz. Edit Item, view Item etc.. Is it Possible? If yes, How can I ...
8
votes
3answers
3k views

CSOM Search API does not return all the results

I am having a problem with the code below. It is not returning all the rows/items which are found in different lists. The total number of items is 28, but the code below is returning 19. I have set ...
8
votes
1answer
407 views

How to automate the provider hosted app trusting?

Is there any way to automate the SharePoint provider hosted apps installation and trusting process from appcatalog using CSOM/Rest API?
8
votes
3answers
1k views

Datasheet view added programatically missing from view selector

I am adding a new view to a list using CSOM (ViewTypeKind = Grid). The same code works perfectly for other types of views. For datasheet views, although they are added and they function properly, ...
8
votes
1answer
1k views

Powershell CSOM - How to add a Office 365 Group to a list

I've found a script to create document libraries and a script to assign permissions to a list. I've combined these with one script and added a CSV containing names and Office 365 Groups that should be ...
8
votes
2answers
770 views

Get user that declared document as record CSOM

Using CSOM is there anyway I can get the user that declared a document as record. I though I could use the last modified but it seems that when declaring a document as record last modified does not ...
8
votes
2answers
2k views

Is it possible to create custom User Profile Properties using CSOM or SPO PowerShell?

I have not been able to find much information regarding creating custom User Profile Properties via CSOM or SharePoint Online PowerShell. Is this possible, and if so, how do I go about doing it?
7
votes
4answers
22k views

Get Current Login User Profile Properties SharePoint

I need to get current login User profile properties provide information about SharePoint users, such as display name, email, PictureUrl and other business and personal information including custom ...
7
votes
5answers
38k views

How to check if the file or folder exist in SharePoint document library using client object model?

Is there any way other than looping through the Files to check whether the folder or files exist in document library using clientcontext - client object model.. Can someone confirm me whether the ...
7
votes
1answer
20k views

CAML Query - Going around the 5000 List Item Threshold

I have developed a SharePoint system for a client and I am planning forward with regards to CSOM code that runs on a specific library. This will eventually expand to a large set of data. Experience ...
7
votes
2answers
3k views

Fail to send email by utility class

I have utility class to send email. currently i am facing error :- a recipient must be specified EmailProperties emailp = new EmailProperties(); emailp.To = new string[] { "robbstark@gmail....
7
votes
2answers
16k views

Get a users Name from their ID

As part of my Sharepoint hosted App i am using a list which contains a Person or Group. I am getting the ID of the person by using the following. var ApproverID = currentItem.get_fieldValues()["...
7
votes
2answers
5k views

Uploading a large file to Office 365 via CSOM PowerShell

I have the following code : $FileStream = New-Object IO.FileStream($File.FullName,[System.IO.FileMode]::Open) $FileCreationInfo = New-Object Microsoft.SharePoint.Client.FileCreationInformation $...
7
votes
1answer
8k views

Create Document Set In Document Library Using CSOM : SharePoint 2010

I am trying to create Document Set in Document Library. I found this code which is for SharePoint 2013 using System; using System.Collections.Generic; using System.Linq; using System.Text; using ...
7
votes
1answer
2k views

How to create “Office 365 Group” using csom/pnp core ( or create accessToken)

Since team sites will not support "site inboxes" for team sites anymore I need to create an "Office 365 Group" (don't confuse this with SP groups/AD Groups), since this is the MS silver bullet of the ...
7
votes
2answers
3k views

Can we access the sharepoint 2013 list from another web application using CSOM

I have to access the sharepoint 2013 list from the site under another web application in the same farm. Is it possible I tried it but, it is not happening. Both the web applications lie in the same ...
7
votes
6answers
24k views

Load all fields for a specific ListItem using CSOM

I want to load all FieldValues for a specific ListItem ForExample public ListItem GetItemById(List SPList, int id, string[] fieldNames) { using (Ctx) { ...
7
votes
2answers
8k views

How to start SharePoint Workflow programmatically using CSOM

I am trying to start share-point workflow using CSOM(Client side object model) by following means of code. But i got the following error from the line mark in comment. Please help me to figure out ...
7
votes
1answer
389 views

How to find the last Logged-In time for the external user for a SharePoint online Site?

I need to know about the information for the external user last logged-in time over a site. Is it possible to get through REST or Client-Object Modal?
7
votes
5answers
4k views

Get size of SharePoint list and library using CSOM

Is there any REST api / any approach to get the size of list and library in a site collection using client object model.? I know we have SPSite.StorageManagementInformation but this is can be used in ...
6
votes
1answer
20k views

Filter CAML Query by List Item ID

I have the below code which grabs all items from a List with the following structure: I want to limit the query results by a specific value of 'ID' (so when the code gets to the enumerator part, I ...
6
votes
2answers
6k views

How to get only custom fields from a list?

I am working with the Client Side Object Model. In a console application I am retrieving all fields from a custom list. The problem is the Clientcontext fetches me a bunch of internal fields I do not ...
6
votes
1answer
7k views

SP - CSOM Load specific properties of object

How to get specific properties of object with C# Client SharePoint object model? My code with JSOM is: Collection of objects: clientContext.load(items, "Include(ID, Title, EmpDays, EmpPosition, ...
6
votes
3answers
1k views

Get the all sub sites from a site collection along with site hierarchy using CSOM

I had site collection is SharePoint online with the below hierarchy. The value in the bracket is the site hierarchy (added for understanding only). I want to get all the subsite details along with ...
6
votes
2answers
416 views

how to change the default gear icon look in SharePoint 2013?

In the top right corner near the ribbon there have a setting icon in SharePoint 2013. I need to change the Gear icon image?
6
votes
1answer
2k views

Creating a contenttype programmaticaly in Sharepoint 2013/Office365

I am looking at the documentation for adding a contenttype via code using Sharepoint CSOM. The example uses a hardcoded ID. foreach (var item in contentTypes) { if (item.StringId == "...
6
votes
2answers
10k views

Assign Unique permission to SharePoint 2013 List using Client Side code C#

I need to assign unique permission to a SharePoint list. I have the SP group created in the site and the list permission inheritance is broken. Now I would like to assign permission to the group for ...
6
votes
1answer
3k views

executeQueryAsync callback with a while loop

I am fairly new to javascript and have spent some time trying to understand callbacks as they relate to SharePoint's CSOM, but have had some issues. Essentially, I am running a query to get a ...
6
votes
2answers
583 views

Is context.executeQueryAsync a transactional operation?

I update multiple items in a loop and then call executeQueryAsync() on ClientContext class and this call returns error (failed callback is invoked). Can I be sure that not a single item was updated of ...
6
votes
3answers
6k views

Query multiple lists using javascript/CSOM

I'm about to query multiple lists using JavaScript (JSOM, SharePoint 2010). It's working when querying one list in a time, but that's annoying when I'm having lots of lists. Working example: ...
6
votes
2answers
7k views

Update/Delete All List-item in SharePoint online list with more than 30,000 records

I have SharePoint Online List which contains more than 30,000 records. There are two use-cases I need to work as below: I have added a new column in that list, I want to update that column based on ...
6
votes
1answer
1k views

create custom content type from schema.xml using csom and powershell

I need to create a content type from my schema file which containe all my fields this is how to create a basic content type: function Add-metaXmlFields-ToContentType($ctx, $xmlFilePath, $CT_id) { ...
6
votes
4answers
9k views

csom FieldUserValue.LookupValue return users displayname, not loginname

(using sp online, csom) I want to get users LoginName the cheapest possible way (ie, avoid executequery). The user is stored in a field of type User. According to this example, the users loginname ...
6
votes
2answers
622 views

Selecting only PowerPoint files in a CAML query

I am trying to select all PowerPoint files in a list. How do I do that? Up until now I used this: class UsedIn { private static NetworkCredential credential = new NetworkCredential("login", "pwd", "...
6
votes
2answers
580 views

Disabling tabular view

I have a bunch of views to create for a couple libraries that are all basically the same except for some filter values. I can create them in PowerShell using ViewCreationInformation. After a bit of ...
6
votes
2answers
1k views

Can we unlock a ShortTerm lock via CSOM for SP2013

We are using SP2013 with OWA installed. Users often complain about a file stored in SharePiont being locked by another user not in office. Error is "The file "xxxx" is locked for exclusive use by ...

1
2 3 4 5
38