API for interacting with SharePoint from .NET, Silverlight, and JavaScript.

learn more… | top users | synonyms

7
votes
6answers
30k views

HTTP 401, Unauthorized using the Managed Client Object Model

I have a Windows 7 system built (per MS' instructions) with SharePoint 2010 Server. I'm writing a simple console application on it that attempts to use SharePoint's Managed Client Object Model to ...
7
votes
1answer
7k views

CSOM Get ListItem of Folder

In an application I'm working on, I'm interacting with SharePoint (2010) via the .NET Client-Side Object Model, and am trying to account for a large number of possible configurations of document ...
7
votes
1answer
5k views

no sorting with JavaScript Client Object Model?

I have the following JSOM code: var query = "<View><Query><Where><Eq><FieldRef Name='Category'/><Value Type='Choice'>ValueA</Value></Eq></Where>&...
7
votes
1answer
4k views

Fetch list of sites in site collection into jQuery

Is there a way to get the list of sites in the current site collection into jQuery as an array or other data structure? Thanks.
7
votes
2answers
2k views

Reliably get attachments for list item

I'm working with SP2010's SP.js and I need to get all the attachments of a list item. As it's SP2010, I don't have access to SP.ListItem's attachmentFiles property. :( The following code works for ...
7
votes
1answer
688 views

JavaScript Client Object Model functionality to get all the non hidden lists of current web and listing them

We have requirement to get all the non hidden lists of current web using JavaScript Client Object Model(JSOM). I have tried the below code but failed to get the desired result. function ...
7
votes
5answers
2k views

Get webpart's Zone Id via CSOM

How to get Web Part Zone Id via CSOM? WebPart has property ZoneIndex but no ZoneId while WebPartDefinition has method MoveWebPartTo(string zoneID, int zoneIndex) but lacks methods to retrieve the ...
7
votes
4answers
10k views

ExecuteOrDelayUntilScriptLoaded too slow in Firefox and Chrome

I want to use CSOM but waiting around 2 or 3 seconds after page load before I can even do my first query is crazy! See below. Using jQuery dom ready shows a reasonable ready time, but SP.ClientContext ...
7
votes
3answers
1k views

SharePoint 2013: Using JSOM, get a list of all sites user has access too

I was looking at the JSOM documentation, but couldn't find a nice way to spin through all site collection and sites to show a user what they have read access to. Is this possible using JSOM and a ...
7
votes
1answer
2k views

Create a Document Library Item base on a ContentType with JavaScript Object Model (JSOM)

I'm trying to create a new item in my Entreprise Wiki Pages Document Library. It's associated with a News Content type. I was able to retrieve the SP.List object (myList), the SP.ContentType object (...
7
votes
1answer
543 views

Set Task list EnableAssignToEmail in CSOM

I would like to set the EnableAssignToEmail bit on a task list via CSOM after a list is created dynamically. I have found a way to do this in Powershell and in code using SPList: Add-PSSnapin ...
6
votes
3answers
505 views

Get Parent web of a subsite using JSOM in SharePoint 2013

How can we get an immediate parent web of a subsite using JSOM ?
6
votes
3answers
15k views

Cannot get field value of list item through JavaScript

I try to get the value of a list item (that is currently selected). I know that I must load it into the context but even with loading the field explicitly I get the following message. Microsoft ...
6
votes
2answers
2k views

Dynamically get default display form url in sharepoint 2013 by REST or JSOM

How can I get default display form url of sharepoint list item via Rest or JSOM. I found the result by link: How to get the Display Form URL, using REST But the XML returns all of the display form ...
6
votes
4answers
15k views

How to use “SPContext.Current.Web.Url” in client object model?

When working with server side code we can use the following line to obtain the url of the current web site: var url = SPContext.Current.Web.Url; How can we do the same when working with the client ...
6
votes
7answers
13k views

SP.ClientContext is always “undefined” in JSLink functions

I'm trying to execute CSOM functions as part of a JSLink extension to override rendering of a Lookup Field. Problem is every time I try to access SP.ClientContext it returns as undefined I have ...
6
votes
2answers
4k views

SharePoint 2010 .NET Client Object Model - add item to Web property bag

I'm trying to add a new item to the Web property bag using the SharePoint managed client object model, but it fails to persist. I'm using the following code: using (var context = new ClientContext("...
6
votes
4answers
13k views

Unable to get property 'get_current' of undefined or null reference

$(document).ready(function () { var count = 0; retrieveCurrentListProperties(); function retrieveCurrentListProperties() { clientContext = new SP....
6
votes
3answers
5k views

How do we create Sub Site using JavaScript object module

My using following script to create Sub site. <script src="//ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js" <br/> type="text/javascript"><br/> </script><br/> &...
6
votes
3answers
16k views

REST Adding New List Item

I am currently using office 365 and lots of REST queries to display data. However I am now creating my own forms using bootstrap and JQuery. However, how do I use REST to add the data to the list. ...
6
votes
5answers
10k views

Accessing Terms in Term Store using JSOM in Sharepoint 2013

I want to display the terms from a term store using Javascript Object Model. How can this be done?
6
votes
2answers
9k views

CSOM get list items, return simple data structure

If we take this code example, we can see we need to call a lot of methods to get to our results (.getEnumerator(), .get_current(), .get_title(), .get_title()) var siteUrl = '/sites/MySiteCollection'; ...
6
votes
5answers
2k views

When I execute a CAML query, how do I know what ListItem details I can include?

I was querying a SharePoint library, trying to retrieve some file attributes. Apparently some things like FileType and Date are not supported, even though those fields are listed as a built in field. ...
6
votes
2answers
6k views

How to modify user profile properties using JavaScript in SharePoint 2013 (Online)?

I need to modify user profile properties using JavaScript (REST or CSOM). How can I do that? I don't see any methods in MSDN documentation about modifying profile properties without server code. ...
6
votes
4answers
10k views

SharePoint 2010 Javascript Client Object Model cross site collections?

I've read some unofficial things online that using the Javascript client object model to retrieve content from other site collections is not allowed due to prevent the equivalent of "cross site ...
6
votes
1answer
122 views

(ClientSide) set/update JSlink to CSR files for (all) WebParts, Views, Fields

Working on iCSR.github.io to make CSR development a bit easier. I now want to make it as easy as possible to set the JSlink connections on WebParts, Views or Fields. I have code snippets to do it ...
6
votes
4answers
5k views

Set DateTime (utc) to listitem (CSOM, SP2013)

How to set UTC timezone to a listitem's DateTime field without executing query each time? This would be slow for many datetime fields and items: var utc = DateTime.UtcNow; var localTime = ...
6
votes
2answers
2k views

How to set list alert using JavaScript in SharePoint 2010?

I need to set a list alert for current (logged in) user using JavaScript. Code: var currentcontext = new SP.ClientContext.get_current(); var currentweb = currentcontext.get_web(); ...
6
votes
4answers
12k views

How to traverse SharePoint Library in Client Object Model?

I have SharePoint Library and i want to traverse all folder and sub folder of it using client object model. Can anybody have solution ?
6
votes
2answers
7k views

Adding description to sharepoint link URL using the C# CSOM

I'm currently adding the URL except the description is an ugly link. I would like to add the description to the URL in a links list on sharepoint online. My current code to add a new item from an ...
6
votes
3answers
1k views

Get if user has permissions to access to a Cloud App for Sharepoint 2013 with JavaScript CSOM or Rest Api

I have developed a Cloud App for SharePoint 2013 on an office 365 server, and I figured out that to set the user permissions(who has access to it) for that app can be find over https://sharepoindomain/...
6
votes
2answers
6k views

How to get file or list item icon in SharePoint 2013 using javascript

My requirement is i have to display files from document library with images using javascript object model or spservices. pls let me now is there a way.
6
votes
2answers
10k views

Format Date using Javascript Object Model

I am using the javascript object model to get a date field back and display it on a page e.g. oListItem.get_item("MyTestDate") This displays on the page by default as: Thu Jul 25 09:30:07 PDT 2013 I ...
6
votes
5answers
9k views

PowerShell and the client object model: “The collection has not been initialized”

I'm trying to grant a user permission to a SharePoint site using PowerShell and the client object model. The code I'm using is as follows: # Setup context $context=New-Object Microsoft.SharePoint....
6
votes
1answer
2k views

JavaScript Client object model, rename folder

I am trying to rename a folder inside a Document library. Right now I get my item and everything is good but when I try to rename it using set_item('title', 'NewFolderName') it crashes and unwinds the ...
6
votes
2answers
5k views

moveTo and moving documents from one library to another

I have followed and successfully implemented the excellent article: SharePoint 2010 ECMAscript – Copy\Move files to another document library – Part 2 located at: http://www.learningsharepoint.com/...
6
votes
2answers
7k views

SharePoint 2010 ClientObjectModel : Find Item by GUID

I have a list of 6000 listitem GUIDs. I need to check if each item still exist on the Web. Previously, I was using the SPWeb.GetFile(GUID) method to check the item. But now I need to convert that ...
6
votes
2answers
10k views

Get list by Internal Name using ECMAScript / JavaScript Object Model

How can I load items from a list using its InternalName? As far as I know I can get it using either Id or Title like the following: var clientContext = new SP.ClientContext('/News/'); var web = ...
6
votes
1answer
400 views

change NavigateForFormsPages value to true using CSOM

I'm searching for a way to change NavigateForFormsPages property using CSOM but no luck till now. Anyone has idea to do it using CSOM
6
votes
1answer
2k views

setting page layout using JSOM

I want to change page layout for some of my publishing pages using a SharePoint-Hosted app. Is there a way to changing (setting) page layout to a publishing page using JavaScript?
6
votes
3answers
5k views

Datetime update is one day off

I'm updating a list with a date field (just the date) using the ECMASCRIPT object model but when the date is inserted is one day off from the introduced date, It's literally making me pull my hair off ...
6
votes
2answers
3k views

How to retrieve distinct values with JavaScript Client Object Model

How can you get distinct values from a SharePoint List column using JavaScript without a huge performance hit? A simple example would be appreciated :)
6
votes
3answers
4k views

How to create SharePoint list with custom template using Managed Client Object Model?

Creating lists in SharePoint using Managed Client Object Model is rather easy task. Here's how to create a list with SharePoint's custom list template: ListCreationInformation lci; List list; lci = ...
6
votes
1answer
1k views

Sharepoint Client context (client Object Model) cant load more than 500 records or more

is here any limitation about read the records from any lists in sharepoint? my codes are default that downloaded from msdn: string siteUrl = SharePointAddressURL; ClientContext ...
6
votes
2answers
2k views

Previous versions of ListItem with CSOM

When using Client-Side Object Model for SharePoint 2013, how can I access previous versions of List Item?
6
votes
2answers
9k views

Check Out, Update, then Check In a File in SharePoint Client Object Model

I would like to programatically update a SharePoint file by checkout/checkin. I have written code that looks like it should do what I want it to do: static void HandleFile(Microsoft.SharePoint....
6
votes
1answer
254 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
0answers
932 views

Use CSOM with ADFS credentials from Single Sign-On enabled ASP.NET MVC app

I have the following setup: ADFS 3.0, SharePoint 2013 and the custom ASP.NET MVC app. Both SharePoint and MVC app are configured to use Single Sign-On from ADFS, so once user is logged in via ADFS, ...
5
votes
4answers
2k views

js library for REST and JSOM SharePoint basic tasks

I am just sick of writing again and again the same piece of code to use jsom Async requests, especially when it's for a SP-hosted app which envokes spexecutor. I am sure each developer has his own ...
5
votes
6answers
13k views

Get a SharePoint ListItem ID from a List where the 'Title' field is a specific value in JavaScript

I am trying to extract the ListItem ID of a List which I am currently NOT in based on a field value in that List. I cant find anything that explains how to do this. So, to explain. I have a Custom ...