Thursday, May 27, 2010

SharePoint 2010 - Client Object Model - Overview

Client Object Model are invented to support growing number of technologies like JSON, REST etc to make the programming model easier and type-safe. .NET based Client applications like Windows, Console, WPF, Silverlight which deal with .NET object & JavaScript and JSON applications which deal with JSON response, now have ability to use type-safe object while working on the client side of the SharePoint.

Client Object Model characterizes the following:
  • Minimize network round-trips/bandwidth
  • Offers subset of server object model
  • Different namespaces than server object model
  • Supports CAML and LINQ queries to access server objects. (LINQ is not support for ECMAScript method)
  • Asynchronous model is supported (For Silverlight and ECMAScript applications only Asynchronous method is supported.)

Client applications for SharePoint 2010 can broadly be categorized into the following.

  • Managed .NET applications
  • Javascript/ECMAScript applications
  • Silverlight applications
  • REST Applications

ClientContext Object :

  • Represents a SharePoint site. This object needs to be initialized by passing URL of a SharePoint site.
  • Implements IDisposable. So needs to be disposed properly at the end by calling Dispose() method on the instance object.
  • This object runs in the context of a Windows authenticated user. If forms authentication is required, “AuthenticationMode” property needs to be set to “FormsAuthentication”.
  • Load() method on the instance allows to LINQ query or pass the site object itself. This populates the context instance object.
  • LoadQuery() method is similar to Load() method but returns a new IQueryable collection object.
  • ExecuteQuery() needs to be called after calling either Load() or LoadQuery() methods so that commands will be sent to the server for execution. Without calling this method, context instance object will not be initialized. Refer to the following code snippet.
  • CAML and LINQ queries are supported while querying objects from the server.

Learn about programming client object model from within the following client applications.

Technorati Tags: ,,,

No comments:

Post a Comment