By: admin



 

Introduction to Client Object Model

 

Client Object Model is the newest feature of SharePoint 2010. It is the subset of server object model which the Microsoft has defined as Microsoft.sharepoint.dll. The primary function is to manipulate and consume share point data. Client Object Model Implement on Window communication Foundation (WCF) service (…/_vti_bin/client.svc)

 

Note:


1. To work on Client Object Model, you need Microsoft.sharepoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll
2. Location of dll will be as follows:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI
3. You Need Microsoft.SharePoint.Client. Namespace on working with client object Model

 

Client Object Model is classified into different classes which are as follows –

 

ClientContext: ClientContext class is used to context information about such objects as site, site collection.
Site: Site class is used to get the site collection.

Web: Web class is used to get the web on current site collection.

List: List is used to get the list.
ListItem: ListItem class is used to get the ListItem.

 

 

How Client Object Model Work?

 

The Client OM send request as an XML format and server will return a JSON (java script Object Notation) which is converted into the appropriate Object Model.
This could be illustrated with the help of the following diagram. It is an easier way to access SharePoint 2010 data using Client Object Model –

 

 

How Client Object Model Work?
Client.svc:

 

Client object model is basically a WCF Web Service which is responsible for communication between client Object Model and Share Point Data. Client.svc is located along with all other SharePoint Web Services. The response from Client.svc Web Service is sent as JSON format.

 

Client.SVC service has one method (ProcessQuery ) which takes SteramObject
ProcessQuery method found in Microsoft.SharePoint.Client.ServerRuntime.dll and private class ClientRequestServiceImpl
Location of client.svc service: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Client.SVC

 

 

Why We Use Client Object Model?

 

1. Share Point installation is not required on development machine. If you want to develop a window application or any other application, you only require dll’s.

 

2. Client Object Model is user-friendly as it poses less deployment problems.


3. Flexibility in language: You can use any of the three different languages for Client Object Model


Microsoft .NET
Silverlight
ECMA Script (JavaScript /JScript)

 

4. Optimization in query speed: In Client OM, you do not need to install the SharePoint Server which is required by the Server Object Model. Thus, Client OM provides much ease to the end user.

 

 

Example of Client Object Model

 

//Method Add items into list
private void AddNewListItem()
{
var: clientContext = new ClientContext(“your site URL/”);
var :list = clientContext.Web.Lists.GetByTitle(“ListName”);

var: param = new ListItemCreationInformation();

var :newItem = list.AddItem(param);
newItem[“Title”] = “This my new announcement”;
newItem[“Body”] = “This is the body of announcement”;
newItem.Update();

clientContext.ExecuteQuery();
}

 

Posted by-

Deepak Chauhan 

 

 

Disclaimer: Developer’s Corner Section of ISHIR blog is contributed and maintained by independent developers. The content herein is not necessarily validated by ISHIR.

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

5 + 20 =

ISHIR is a globally diversified leading offshore software development company with experience and expertise in a broad range of services and solutions. With 15 years of experience in the IT industry, ISHIR enables cost-effective and dependable software outsourcing solutions. We have over 900 satisfied clients across the globe and matured to become an extension of their internal teams.

We are experts in the field of software development, web design and development, managed cloud services, software testing, application development services and customer software development. India is a sought after market for addressing software development outsourcing requirements for enterprises across the world. ISHIR offers the value add of in-depth knowledge of all the key industries combined with the commitment to innovate and offer next-generation technological advantage. As a renowned custom software development company in India, one of the key differentiators that we offer is to understand our clients’ business objectives and challenges and align the right technology to provide customized solutions.

Headquartered in Dallas, with global delivery center in Noida, India, we are one of the preferred software development companies with a unique combination of skilled people, world-class processes and robust technology. ISHIR has a successful track record of delivering hundreds of projects using various tools and technologies. We have delivered on-time and on-budget custom software development services and application development services. Using our flexible delivery models, we have ensured success in all our offshore outsourcing projects. We have added substantial value and savings for our clients, often exceeding up to 85%, making us a dependable offshore Software Development Company. As a front runner software development company, India, we ensure that we go the extra mile to maximize ROI for our clients and act always as a trusted advisor of our clients.

Help desk software