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.
130
questions
10
votes
1answer
18k 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 ...
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:
...
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 ...
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 ...
4
votes
1answer
3k views
How to create a list template by using CSOM?
For creating a list template programmatically by using server object, I'm using the SaveAsTemplate() function.
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (SPSite oSPsite = new SPSite(...
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 ...
8
votes
8answers
46k 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 ...
7
votes
1answer
18k 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 ...
1
vote
3answers
1k views
How to get ClientContext in CSR?
In a document library's /Forms/AllItems.aspx, I am trying to render a column from ID to a file URL (FileLeafRef).
However this line of code:
clientContext = new SP.ClientContext.get_current();
...
1
vote
3answers
1k views
CSOM: Identify “columns” created by user rather than built-in
When iterating the fields of a list how do you know which columns are yours and which are built-in ?
I know a solution for "classic" SDK using SPField.SourceId (https://sharepoint.stackexchange.com/...
0
votes
2answers
910 views
SharePoint Context and Caml query is not working
Here is my code..
var CmalQuery="";
var fieldName="";
$(document).ready(function () {
$('#btnSearch').on('click', function () {
txtValue = $('#txtSearch').val();
fn();
});
...
4
votes
3answers
3k views
What exactly is the webPermMasks property?
I'm trying to understand what exactly is the "webPermMasks" property inside the "_spPageContextInfo" object, I tried to look in many websites on the web and also in the MSDN.
In the MSDN I wasn't ...
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 ...
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 ...
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 ...
6
votes
5answers
35k 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 ...
5
votes
2answers
5k views
Difference between OData, REST and client object model
I am new to SharePoint, and confused about all of these terminologies, what are the differences between these 3? when do we use each one?
5
votes
2answers
1k views
Configure search navigation and set to inherit from parent site with CSOM
I am working on a solution in SharePoint Online where I want to accomplish the following using CSOM:
Update rootweb search navigation (also known as search verticals) to display "Search everywhere" ...
4
votes
1answer
596 views
upper/lower case naming convention for Document name in SPO Doc Lib
I have a situation where users have uploaded several files but without any naming convention. So some of the file names are in upper case while some are in lower case . So Now I have to build a script ...
3
votes
1answer
3k views
Access Old Version File objects with CSOM
I created a WCF service that uses Client-side Object Model (CSOM) to query file information from a SP Document Library.
I need to create a List<File> with all the files associated with all the ...
3
votes
1answer
35k views
Retrieve all fields from a list using Powershell (CSOM)
I need to write a script which I can launch (for example) at specific time and which will make a save of all lists on the SharePoint.
For now, the script is able to connect to SharePoint and retrieve ...
3
votes
2answers
8k views
How to attach files to list item using Client Object Model?
I have a SharePoint List to which I am adding new ListItems using the Client Object Model.
Adding ListItems is not a problem and works great.
How to add Attachments?
2
votes
2answers
11k views
JavaScript client object model - get current user email id, first name, last name
I want to understand the difference between the following two methods to retrieve the current user email id:
Method 1:
function getCurrentUserEmail(){
var clientContext = new SP.ClientContext....
1
vote
3answers
2k views
ExecuteQuery Error When Trying to Do Anything
I'm a global admin on my O365 tenant. I get the below error when I try to access anything:
Exception calling "ExecuteQuery" with "0" argument(s): "Cannot contact web site
'https://domain.sharepoint....
0
votes
2answers
8k 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 ...
3
votes
1answer
909 views
ServerUnauthorizedAccessException Issue with CopyTo() method in Sharepoint Client Side Object Model
I'm trying to copy over a publishing page across the Pages List from a source site-collection to a destination site-collection. All works well but when the control hits the context.ExecuteQuery() ...
2
votes
2answers
738 views
Stop Workflow Triggering When SystemUpdate is called
I am using SystemUpdate in CSOM to update list items. It works fine and does not update modified date and modified by field. But it will trigger workflow attached to the list. Is there a way to stop ...
2
votes
1answer
7k views
Checking if file is checked out through CSOM
Is there a way to check if a file is checked out by another user? I am going trhough a list file by file and would like to avoid the "file is opened by another user" error. Something like this would ...
2
votes
3answers
16k views
SharePoint 365 Upload file to subfolder List with .NET C# CSOM
I'm just doing some tests for upload files with C# console App but I can't. I've tried everything but with no success, here my code.
ĀæWhat do I try? In the List "Contact" there is a sub-folder ...
0
votes
2answers
2k views
Check an user belongs to a AD group inside SharePoint Group using SPServices JQuery
I want to check the current user exisit in a AD group inside the SharePoint Group using SPServices JQuery. I used the below code snippet but not successed. Any suggestions?
$().SPServices({
...
4
votes
3answers
3k views
Add web part so that we can retrieve it later via CSOM?
How to add a web part on page in such a way that we later on can find it (using CSOM) - Can we somehow store identifier information to the web part? Say user could change the title and description (so ...
3
votes
3answers
2k views
Project Online - CSOM - How to update TimePhase for multiple resources
We have always updated timephased data in Microsoft Project using PSI (impersonation) and are trying to mimic this solution with CSOM to allow integration with Project Online. Much to our dismay we ...
2
votes
2answers
2k views
Setting List Metadata Navigation settings using CSOM
How would I use the SharePoint CSOM to configure the Metadata navigation Settings for the documents list? This is for an online SharePoint instance and I haven't been able to find anything online for ...
1
vote
1answer
15k views
List files in a specific folder in a document library
I there anyway to output the files of a specific folder in a document library?
Listing them will be like
foreach $file in $folder.files
{
write-host $file.name
}
But how do I tell it to look ...
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 ...
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 ...
5
votes
1answer
2k views
CSOM site provisioning error: The request uses too many resources
I continue to get an error (sometimes) when provisioning a web using CSOM. According to this MSDN article, this error is returned when the CSOM request exceeds 2MB. I watched the call in Fiddler and ...
4
votes
2answers
5k views
Adding Read-Only-permissions to a list for a Sharepoint Group using Powershell CSOM
I am trying to add read-only-permissions to a specific group called "Students" for a list I have created called "Quiz". I have to use PowerShell CSOM, and in every other tutorial I've been through, ....
4
votes
1answer
3k views
How to get “Active Directory” groups in Sharepoint 2013 using “Client Object Model”
I tried this code, but I get only the SharePoint Groups.
var groupCollection;
function getAllGroups() {
var ctx = new SP.ClientContext();
groupCollection = ctx.get_web().get_siteGroups();
...
4
votes
2answers
6k views
Adding ListViewWebPart with CSOM
I have to add a few webparts to a default page using the Client side object model. For the most part this goes fine, I can add a XSLT and content query webparts.
However, when i try to add a ...
4
votes
0answers
2k views
SSL certificate error when using Client Side Object Model
I wrote an app that gets information from some Sharepoint 2010 lists and displays it to the user.
It works fine on my development machine.But when I copied the exe to another desktop machine I got the ...
3
votes
1answer
7k views
clientContext.Credentials = CredentialCache.DefaultNetworkCredentials - in CSOM returns 401 unauthorized thru IIS
I am trying to access SharePoint site using CSOM with Windows Authentication. It works if I run it in Visual Studio on a server. However, it returns a 401 unauthorized when I run the site through IIS ...
3
votes
3answers
9k views
using CSOM to retrieve fields in a list in a view
I am trying to use the CSOM to retrieve all the displayed fields in a particular view.
I require to know the field type and field internal name.
I can not do:
var list = hostWebContext.get_web()....
3
votes
1answer
3k views
Configure custom forms for New and Edit using CSOM
I want to replace the New and Edit forms for a specific list. I have a SharePoint Add-in which has two forms (one for New and one for Edit) and now I want to make sure that when a user click New or ...
3
votes
2answers
7k views
SharePoint Online CSOM PowerShell Script to create folders and add permissions
I am rather new to this place but quite few previous posts helped me out a great deal while creating some PowerShell scripts. I have been trying to create a script that will create a couple of folders ...
3
votes
1answer
2k views
CSOM add webpart Script Editor Webpart
i seen a ton of examples adding ContentEditorWebpart to publishing page, which i tried and works great.
my question is is there a way to ScriptEditorWebpart to publishing page using CSOM.
Changing ...
2
votes
1answer
1k views
Query list for all list items and their attachments using CSOM
I've used the following code to retrieve the list items on my SP site. The following code will return "Value does not fall within the expected range" if I try to get the AttachmentFiles:
...
2
votes
2answers
1k views
Write multiple people in multi-value person field using PowerShell (CSOM)
I have a CSV file which contains semicolon-separated Values to a certain field:
Reviewer
domain\userOne;domain\userTWO
In PowerShell (CSOM - executed on my local computer) I am grabbing this data ...
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
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?