Last week one of my colleague took a session for all of us to explain the Client Object Model in Sharepoint 2010, so i thought to share the knowledge via this blog article.
What is Client Object Model (COM)
Client Object Model (Client OM) is a unified model which can be used by developers to access the server. The Client OM can be accessed via web services, via a client (JavaScript) API, and via REST. Microsoft SharePoint 2010 introduces three new client APIs that allow you to interact with SharePoint sites from script that executes in the browser, from code that executes in a .NET managed application, or from code that executes in a Microsoft Silverlight 2.0 application.
Key Points one should know about the COM:
The following table shows the equivalent objects that the new APIs provide for common SharePoint Foundation 2010 server objects.
What is Client Object Model (COM)
Client Object Model (Client OM) is a unified model which can be used by developers to access the server. The Client OM can be accessed via web services, via a client (JavaScript) API, and via REST. Microsoft SharePoint 2010 introduces three new client APIs that allow you to interact with SharePoint sites from script that executes in the browser, from code that executes in a .NET managed application, or from code that executes in a Microsoft Silverlight 2.0 application.
Key Points one should know about the COM:
- There are limitations to what can be done client side compared to server side, say for example you cannot access the FARM level properties, you can get/set only the properties at the web application level.
- we cannot elevate the privilege in COM as we can do in server object model.
- No SharePoint installation is required in the development machine.Only the Client DLL's are required.
- No Compilation required as required on the server side, NO IISRESET required.
- Path to get DLL's: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI
The following table shows the equivalent objects that the new APIs provide for common SharePoint Foundation 2010 server objects.
Server Object Model | .Net Managed & Silverlight | JavaScript |
SPContext | ClientContext | SP.ClientContext |
SPSite | Site | SP.Site |
SPWeb | Web | SP.Web |
SPSite.Title | Site.Title | SP.Site.get_title() & SP.Site.set_title() |
Client Object Model Mechanics
Below mentioned diagram explains the architecture of the Client Object Model in Sharepoint 2010
Image Reference is here
- Client Object Model is a façade on top of WCF service.
- Requests for the resources are batched using Load & LoadQuery methods.
- Requests are executed using ExecuteQuery or ExecuteQueryAsync methods.
- XML document with batched request information is sent to server.
- JSON response with requested resources is sent back to the client.
In our subsequent articles we will describe how to implement each of the COM using different client.
I Hope this article was informative. Happy Sharepointing !
Please do Share/Like/Comment if this article was helpful.
Please do Share/Like/Comment if this article was helpful.
Good Article
ReplyDelete