-->

SharePoint Client Object Model

The concept of development using the Client Object model was introduced in SharePoint 2010 and has been carried to the new versions. With the introduction of client-side object model, developers have the ability to perform core SharePoint functionality by using C# (managed client object model), JavaScript and Silverlight.

Client-Side Object Model Fundamentals:

The managed and JavaScript client object model are maintained in separate libraries, which are located under a SharePoint system directory. The managed client object model is contained in the assemblies Microsoft.SharePoint.ClientRuntime.dll, which can be found in the ISAPI folder. The JavaScript client object model is contained in the library sp.js, which is located in the LATOUTS folder. Each of these models have different programming interfaces which interact with SharePoint through WCF service named client.svc as shown in below figure.


SharePoint Client Managed Object Model is a SharePoint API that runs on the client side. It converts the API calls made by the application, into XML request and sends it to the SharePoint server. On the server, the XML request is handled by a service called Client.svc where it translates the XML request in to appropriate Object Model calls (SharePoint Server Object Model) and gets the results. After getting the results, Client.svc translates them into JavaScript Object Notation (JSON) and sends back to the Client Managed Object Model. On the client side the JSON response is translated into ECMAScript objects for ECMAScript.

Initializing the Client-side object model:  


Much like the Server -side object model, which is the other framework for development in SharePoint, CSOM also needs a starting point in the form of a central object which will instantiate and provide access to the client object model.  This central object is called the Client Context. The Client Context object orchestrates requests and initiates actions within a site collection. Once the Client Context Object is initialized, it provides information to the site collection or website through which we can access other SharePoint client object remotely



Four client APIs


With the Client Object Model, Microsoft has introduced a set of new APIs to work with to ease the daily tasks of developers.


  1. .NET Managed Applications (using the .NET CLR)
  2. Silverlight Applications
  3. ECMAScript (JavaScript, JScript)
  4. REST

The client APIs provide you as a developer with a subset of the Microsoft.SharePoint namespace which is based on the server-side object model.

0 comments: