The SharePoint 2010 Client Object Model feature is definitely in my top 10 list of SharePoint developer enhancements. It basically provides an abstraction layer so that client apps can interact with SharePoint – there are basically 3 flavors of Client Object Models:
- For .Net managed clients – uses the Microsoft.SharePoint.Client.dll in the “14\ISAPI” folder
- For Silverlight clients – uses the Microsoft.SharePoint.Client.Silverlight.dll from the “14\LAYOUTS\ClientBin” folder.
- For Javascript client code – using the SP.js file from the “14\LAYOUTS” folder.
These 3 client models all talk with SharePoint through the client.svc WCF service and all provide complete access to SharePoint artifacts such as site collections, sites, lists, items, files, folders, webparts, security, content types, etc …
If you need to retrieve data you will typically have 3 steps you need to perform:
- Create a connection using the ClientContext object
- Create a select statement and provide it to the ClientContext.Load method – you might want to take a look at how to create LINQ queries with Lambda expressions since you will need this in more advanced scenarios e.g. ctx.Load(w.Lists, lists => lists.Include(prop => prop.Title, prop => prop.Id, prop => prop.Hidden));
- Execute the query using ClientContext.ExecuteQuery
There is a great series of blog postings from Steve Peschka about practical use of the Client OM:
- Using the SharePoint Client Object Model Part 1 – Introduction
- Using the SharePoint Client Object Model Part 2 – Retrieving data from a list
- Using the SharePoint Client Object Model Part 3 – Creating and using filters when querying for data via het client OM
- Using the SharePoint Client Object Model Part 4 – Creating a list and managing fields
- Using the SharePoint Client Object Model Part 5 – creating additional ECM menu items
You can find some list of articles on SharePoint 2010 client object model here.
ReplyDeleteCOM complete details:
http://praveenbattula.blogspot.com/2010/02/sharepoint-2010-complete-details-about.html
ECMAScript- Client OM:
http://praveenbattula.blogspot.com/2010/02/sharepoint-2010-client-object-model.html
ECMAScript - How to know all methods:
http://praveenbattula.blogspot.com/2010/02/sharepoint-2010-ecmascript-how-to-know.html
ECMAScript - Small Example:
http://praveenbattula.blogspot.com/2010/02/sharepoint-2010-ecmascript-how-to-know_26.html
LoadQuery vs Load:
http://praveenbattula.blogspot.com/2010/03/sharepoint-2010-loadquery-vs-load.html
Managed ClientOM:
http://praveenbattula.blogspot.com/2010/03/sharepoint-2010-client-object-model.html
Silver light Client OM:
http://praveenbattula.blogspot.com/2010/03/sharepoint-2010-silverlight-client.html