Saturday, 19 May 2012

Client Side Object Model (Ecma) Script Overview


Client Side Object Model(CSOM) ECMA Script :

  SharePoint 2007 to access List Items or other objects from within a SharePoint environment the only choice available was to use the server object model, perhaps from the code behind in a web part or application page, or in a Service running on the SharePoint machine. Outside of a SharePoint environment, the only option was to use Web Services with all of the inherent limitations and inefficiencies.

SharePoint 2007 and don’t want to write the server side code then we call SharePoint Web Services.
Architecture:




  

Client Side Object Model has include Three object Model

Three Object Models:

1 .Net CLR

The .NET CLR version is used to create applications such as WinForms, Windows Presentation Foundation (WPF), and console applications, as well as PowerShell scripts

Microsoft.SharePoint.Client.dll   Microsoft.SharePoint.Client.Runtime.dll

2. Silverlight:

The Silverlight version works with both in-browser and out-of-browser Silverlight applications.

Microsoft.SharePoint.Client.Silverlight.dll,  Microsoft.SharePoint.Client.Silverlight.Runtime.dll

3. Javascript:

The JavaScript version enables your Ajax and jQuery code to call back to SharePoint

SP.js

  

Client Side Object  Model  Mechanism:



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.


Advantages:

   1.Design client applications that access SharePoint content without installing code on the server that runs Microsoft SharePoint Foundation 2010.

 2.The SharePoint Foundation 2010 managed client object model lets you write client-side code to work with all the common objects in SharePoint sites. Through the object model, you can add and remove lists, add, update, and delete list items, change documents in document libraries, create sites, manage permissions of items, and add and remove Web Parts from a page.


Examples:

 1. A software company that sells a traditional rich client application wants to integrate SharePoint document libraries and lists into their application, and they want this integration to be seamless, or even invisible to their users.

2.A team leader creates a SharePoint site that has many lists that are required to manage her team’s mission. She wants to change these lists in an ad-hoc manner—perhaps updating assignments and estimates based on an Open XML spreadsheet, or moving items from one SharePoint list to another. She wants to write a small custom application to help her manage this.

Difference in Object Model Vs CSOM:

The bundling of multiple method calls into a single call to the server is dictated by the realities of network speed, network latency, and desired performance characteristics. If the SharePoint Foundation 2010 managed client object model interacted with the server at every method call, the performance of the system, and the increased network traffic would make the system unworkable.

As I mentioned, you explicitly control when the SharePoint Foundation 2010 managed client object model bundles method calls and sends a request to the server. As part of this process, before you start the interaction with the server, you must explicitly specify what content that you want to retrieve from the server. This is the biggest difference between the SharePoint Foundation 2010 managed client object model and the SharePoint Foundation 2010 object model.

Ecma Script Supporting Areas in Sharepoint:

*      Site Collections and Sites

*      Lists, List Items, Views, and List Schemas

*      Files and Folders

*      Web, List, and List Item Property Bags

*      Web Parts

*      Security

*      Content Types

*      Site Templates and Site Collection Operations








2 comments:

  1. Hi Raj,
    It is very usefull to me, i have spend with this 15min keep it..........

    ReplyDelete
  2. Hi Raj,
    You said Site Templates and Site Collection Operations
    are one of the area of ECMA ... so can you Explain it something deep with examples.

    ReplyDelete