SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The CSOM samples from Microsoft.. the samples I find online.. blog posts and resources.. ALL seem to use CSOM from a C# app.

If the push is to write Apps and use a client-side model, why are there no official samples, guides or decent resources AT ALL for using CSOM from, you know, the client-side?

Is it not really meant to be called from Javascript? Is it just a blind spot in the documentation "at the moment"?

..How am I supposed to write apps with the recommended route? SP2013 is launched, isn't it?

share|improve this question

The JavaScript client-side object model is implemented throught the SP.js api.

Here is the doc on msdn : The ClientContext property (in the link above) is one of the most useful to work with lists and other stuff from your SharePoint site.

If you install the Napa Development Tools you may create a new SharePoint-hosted online (in NAPA) and start using CSOM (with JavaScript) easily.

Hope this help.

Otherwise there is a few books explaining how to use the CSOM with JavaScript in SharePoint-hosted Apps and/or with C# in Cloud-hosted Apps.

I bought this one wich is great to start programming against SharePoint with CSOM (chapter 2) :

share|improve this answer
+1 for Hillier and Pattison's book reference. It's a great starting point for JSOM and REST – Josey Aug 23 '13 at 18:35

To avoid confusion CSOM is used almost exclusively to refer to the .NET implementation of CSOM. If you're looking for the javascript version the accepted it rather daft term is JSOM.

share|improve this answer

The Approach Microsoft recommends is to off-load the processing outside of SharePoint Farm.

Reason I read from books (which makes sense) is because of following

  1. Users postpone upgrade of SharePoint because it takes time for them to upgrade custom solution they wrote , test it in new versions etc. Only way is to remove tight dependency.
  2. Other valid reason is to allow users to have more flexibility in Office 365 Environment which was limited with Sandbox solutions that was introduced in SP2010.

Being said that. It is not that they want us to write only JavaScript code, but run any code outside of SharePoint farm. Two ways to do are using Javascript and C#. In SharePoint 2010 CSOM was introduced, that allows you to write C# / javascript code to access SharePoint objects. In this version of SharePoint 2013 this CSOM has been upgraded to support more missing features. Please refer to this link for almost samples you would need. But there are few projects not working still it is good start.

share|improve this answer
Thanks, but those samples do not demonstrate CSOM from Javascript, that's my point.. why not? – Kieren Johnstone Apr 13 '13 at 7:41… this is one Example – Kusek Apr 13 '13 at 20:41
...that's REST. CSOM+Javascript, do you not understand what I'm saying? – Kieren Johnstone Apr 13 '13 at 22:08

Here are a few sites with code samples for JSOM (CSOM):

The trick in general though is to figure out the JavaScript equivalent of the C# methods/props from "old school" programming (by old school I mean circa 2010 c#). Use SharePoint Manager to help track down what namespace a given prop belongs to and then look it up on MSDN to find it's constructors/methods/props. I will note however that not all properties are accessible with JSOM as it's still in its infancy.

share|improve this answer

I have a course on Pluralsight that covers Client Object Model and REST API development in SharePoint 2013. In it I cover CSOM development with JavaScript from the basics to list and list item creation, updating list items, exception handling, cross-site calls, working with documents and libraries, working with managed metadata, search, user profiles, and more. If you don't have a subscription you can get a free trial by clicking here.

I also have some of the slides and demos from the course in a conference talk I give. You can download those from my SkyDrive.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.