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

learn more… | top users | synonyms (1)

34
votes
10answers
17k views

How do I know if the page is in Edit Mode from JavaScript?

Is there a way to find out if a page is in Edit Mode from JavaScript? I know in on the server-side can be found using SPContext.Current.FormContext.FormMode but I can't find any means of doing it ...
10
votes
1answer
3k views

Client Object Model Equivalent of SPSiteDataQuery?

I'm looking for an equivalent to the SPSiteDataQuery functionality in the Client Object Model (COM). The CamlQuery can be used with an instance of List to execute SPQuery level of aggregation, but is ...
3
votes
3answers
827 views

Dispose in Client Object Model

Should objects be disposed when using the client object model? If so, which ones? There seems to be plenty of information on this for server side, but nothing from Microsoft specifically about ...
38
votes
6answers
32k views

How do you get the current list item in JavaScript?

There's all kinds of ECMAScript class library examples around but all of the ones I find show how to retrieve all list items (through SP.ClientContent) but how do you get the current list item? I'm ...
9
votes
2answers
8k views

Pass parameters in ExecuteOrDelayuntilScriptLoaded in Javascript client Object model

I have written a javascript client-object model code and I am calling it through the below line code from content editor webpart: ExecuteOrDelayUntilScriptLoaded(getWebSiteData(sys), "sp.js");// ...
11
votes
3answers
4k views

Grab a specific property bag using ECMA script

I am trying to grab a key/value pair from a specific property bag but can't find any documentation or example code on how to grab a property bag. Currently I can only seem to grab allProperties. Here ...
5
votes
1answer
493 views

structure of sharepoint javascript functions

I am trying to understand more the structure of javascript functions in SharePoint. Why does every function begin with som value than colon and semicolon like ULSrE8:; in spgridview.debug.js: ...
4
votes
4answers
17k views

Get Items Under Folder CAML

I am trying to retrive all items that are under a certin folder, in a document library. this is what i have so far List DocumentsList = clientContext.Web.Lists.GetByTitle(list); CamlQuery camlQuery ...
5
votes
3answers
5k views

How to Use ECMA CSOM to Set a Field of Type SPFieldUserValue

I have a JavaScript array containing the string representation of some usernames (domain\username format). Using the JavaScript CSOM, what is the best way to create a new item and add those usernames ...
0
votes
1answer
3k views

Add an existing WebPart Using the Sharepoint client object Model [duplicate]

My knowledge of the Client Object model is fairly limited, although I have been able to remove and move existing web-parts on a particular page. But I'm now struggling to find and then add a custom ...
12
votes
3answers
3k views

Client Object Model equivalent of SPUtility.SendEmail in SharePoint 2010

I am trying to send an email after an action occurs in Silverlight WebPart I am designing. Is there a built-in class in the Client Object Model that can handle this, or will I have to build a ...
3
votes
2answers
19k views

Get current user in Client Object Model with javascript?

var ctx = new SP.ClientContext.get_current(); var web = ctx.get_web(); ctx.load(web); var user = web.get_currentUser(); alert(user); I used above code to get the current user using JavaScript, but I ...
12
votes
2answers
2k views

Cannot add custom web part to page using the JS OM

I'm trying to add a custom web part (that is one I have written myself) using the new Javascipt OM available with SharePoint 2010. My solution is also running within the Sandbox. I have it working ...
2
votes
1answer
5k views

jQuery & SP2010 : Upload document to library using jQuery?

I built a custom form that saves the data to multiple lists with on click; it works pretty well for its intended use (keeping the data related). Thing is I am totally new at jQuery and SPServices, but ...
8
votes
1answer
4k views

How to get a list of all Choice field options using Client Object Model

How would you get a list of all the possible choices from a choice field (e.g. Task list Priority or Status fields) using javascript client object model?
6
votes
4answers
10k views

Javascript to display sharepoint list items on page load

With Client Object Model API and a bit of javascript, I want to retrieve the items of a sharepoint list and display them into the web page, when the web page loads. I've successfully implemented ...
4
votes
5answers
17k 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
4answers
2k views

How to access a Web application/Farm level property bag via jQuery/Javascript/ClientContext

It it possible to access the Web application/Farm level property bag using jQuery/Javscript/ClientContext? If not, then what are the possible alternatives to access Web Application Farm level property ...
6
votes
1answer
3k views

How to Upload File to Document Library using JavaScript Client Object Model?

I want to Upload File to a Document Library using JavaScript in SharePoint 2010. I found that you can copy file from One Document Library to Another but you can't upload File using JavaScript on this ...
9
votes
8answers
10k views

How do I determine a user's SharePoint group membership using the client object model?

I want to redirect users from a landing page to another page in SharePoint 2010, based on their group membership. I need to do this using JavaScript (ECMAScript) and not server side code.
6
votes
2answers
13k views

ExecuteOrDelayUntilScriptLoaded not executing after page publish

In SharePoint 2013 I have a page that is using the Script Editor web part. In the script editor web part I have the following: ExecuteOrDelayUntilScriptLoaded(startIt, "sp.js"); function startIt() { ...
6
votes
1answer
1k views

Working With Content Approval / Moderation In CSOM

The SharePoint Object Model provides a property of an SPListItem called SPListItem.ModerationInformation.Status to allow you to determine the current content approval / moderation status if a document ...
5
votes
3answers
10k 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 ...
4
votes
2answers
7k views

How to retrieve lookup values using ClientContext?

What's the best way to retrieve lookup values using ClientContext? I'm accessing a list using ClientContext (let's call it ParentList). That list contains several lookup fields (let's call one of them ...
4
votes
1answer
8k views

How to get all fields of a list using JS Client Object Model

Is it possible to retrieve all fields of a list (or default view) through the JavaScript Client Object Model and filter the fields on type (e.g. I only want the Choice fields). var clientContext ...
3
votes
3answers
3k views

Javascript to get GUID from SharePoint

I am newbie to SharePoint and I am uploading a file to the server using javascript. Now the task is to get the GUID of that file and display it ({alert(guid); is fine). I don't even know where to ...
3
votes
3answers
6k views

How to get list by url using client object model?

Is it possible to get list by url using ECMA script client model? For example something like this: context.get_web().get_lists().getByUrl("Lists/MyList");
2
votes
2answers
2k views

HTML from Rich Text Field as Plain Text

First off I want to be clear I am using the Silverlight Client Side Object Model in solution. So I cannot use objects/properties from the server object model. What I am trying to do is get the plain ...
1
vote
1answer
8k views

How to retrieve a ListItem using the Javascript Client Object Model?

Right now I am using this method: function getWebProperties(id) { var ctx = new SP.ClientContext.get_current(); this.website = ctx.get_web(); this.listCollection = website.get_lists(); ...
1
vote
0answers
469 views

Get group membership of current users using ECMAScript [duplicate]

Possible Duplicate: How do I determine a user's SharePoint group membership using the client object model? How can I use the client object model to get a list of all (SP) groups the ...
0
votes
3answers
109 views

get current user info using jquery ,REST and com

My goal is to get the login name and picture for the current user. I am using SharePoint 2013 Foundation. I tried three method and non of then worked correctly: This is with jQuery SPServices: ...
0
votes
1answer
184 views

What is the purpose of Microsoft.SharePoint.Runtime.dll in CSOM?

I know we need to use Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime dll's reference in .NET managed CSOM application development. But can someone help me understand why we have ...
0
votes
2answers
322 views

How to attach documents stored in document library to mails using Client Object model in Sharepoint?

I am trying to attach a file present in a doc library and send it using smtp in client object model. Its in office 365. It throws an exception "The given path's format is not supported". Is there any ...
0
votes
1answer
994 views

Registering pageComponent using ClientObjectModel

is there any ways to register PageComponent using client object model? I want to add custom action on the edit form with dynamically populating FlyoutAnchor. But when page has been loaded i recieve ...
1
vote
3answers
6k views

How to authenticate user in sharepoint online using javascript

I have one sharepoint online 365 site. In that one public site will be there. In that there is sign-in option. Generally When ever user clicks on signin it will redirect to microsoft login page. But i ...
6
votes
2answers
2k 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 :)
8
votes
3answers
12k views

How can I use the SharePoint Javascript Object Model from a plain HTML page?

I would like to use the SharePoint Javascript Object Model from a "plain" html page (ie, not an .aspx application page etc.) Is this even possible? If so, what scripts should I reference? I've added ...
7
votes
2answers
5k views

Check if user is in a specified group

I would like to check with JavaScript if the current logged user is in a specified and specific group (for example called "Admins Group"). How can I do? Thanks
6
votes
3answers
10k views

How to access list in SharePoint Hosted App?

I want to create an Sharepoint hosted app but how to access list in these App ??
6
votes
4answers
7k 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
2answers
4k 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: ...
6
votes
1answer
2k views

Context Menus - Send To not working in IE9

I have a document center with a custom master page. The page is designed with IE9/HTML5/CSS3 in mind. In my other question, I worked out how to fix the IM Presence icons by fixing some core ...
6
votes
1answer
2k 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.
5
votes
3answers
1k views

Create a new wiki page using the 2013 Client Library

I'm using the SharePoint 2013 Client Library and am trying to generate new wiki articles. I'm able to connect, retrieve the web, find the list, but I can't add items. I feel like I need to be using ...
4
votes
2answers
2k views

How to read a column type SPUser, DateTime, Currency with EcmaScript?

I have a list in SharePoint 2010 with some columns. All are default types. So I have "Single line of text" "Multiple line of text" "Date and Time" "Choice" "Number" "Currency" "Person or Group" ...
4
votes
2answers
3k views

Attach a Javascript function to an OOTB ribbon button

I want to attach a custom javascript function to the out of the box "Download a copy" ribbon button. This is to provide analytics for file downloads done through the ribbon button. I tried this ...
3
votes
1answer
4k views

SP2010 Javascript REST API: updating list item using MERGE and POST

I am trying to use REST API approach in javascript to update a sharepoint list item where I have an id. So I use GET and POST to create records, but per MSDN article it looks like the way to do this ...
1
vote
2answers
758 views

Error while pdating Master Page through JavaScript Client Object Model using SP 2013 App

I have created a Site Collection in SharePoint 2013 online. In this site I am trying to update Master Page through JavaScript Client Object Model. My JQuery scripts are able to change the Site Master ...
1
vote
1answer
9k views

The property or field has not been initialized. It has not been requested or the request has not been executed

I am getting this error and from what I understand this is when you try and access columns from the list item. I have tried various things including the line below: clientContext.Load(items, eachItem ...
7
votes
1answer
4k views

Get a value included from a lookup column using the JavaScript Client Object Model

Related: How to retrieve a ListItem using the Javascript Client Object Model? In my previous question I was able to successfully retrieve a basic value from a list item. My problem is that I am now ...