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
171 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
17k 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
2k 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
699 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
183 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
15k 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
44k 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
2k 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
8k 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("...
8
votes
1answer
359 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
958 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
510 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 ...
7
votes
4answers
20k 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
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 ...
7
votes
2answers
2k 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
15k 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
4k 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
7k 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
1k 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
2answers
7k 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
362 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
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
5answers
3k 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
5answers
30k 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 ...
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
3answers
953 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
1answer
14k 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 ...
6
votes
2answers
388 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
489 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
6k 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
2answers
394 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
5answers
19k 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) { ...
6
votes
2answers
542 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 ...
6
votes
1answer
2k views

How to copy the entire source folder to target folder within same document library using c# and CSOM?

I want to copy the entire source folder to target folder within same document library using c# and CSOM I've folder structure like in Shared documents/Expenses will be the source folder. the target ...
6
votes
4answers
4k views

Sharepoint asks for log in multiple times

I am using SharePoint 2013. When I log in in my site it asks me to do so 3 times. I think the reason behind it is because I am using two apps, so it once asks to log in into the page and later asks ...
6
votes
0answers
357 views

How to set HTML field security using CSOM

Is there a way to set the HTML field security using CSOM? I already found a way to use PowerShell Scripts but i wondering if there is also a way to use CSOM. PowerShell: $web.ScriptSafeDomains.Add("...

1
2 3 4 5
35