SharePoint 2010: Introducing the Client Object Model

by Chakkaradeep 19. August 2009 23:02

SharePoint 2010

 

Today

If you want to access SharePoint Server 2007 Data today, you have two ways of doing it (based on your needs):

  1. Writing a Server Application
    • This application resides in server
  2. Writing a Client Application
    • This client application can run from any other server or a desktop

How are we building these Server and Client applications today?

Server Application

SharePoint Server Application

We interact with the Server Object Model, which are nothing but SharePoint APIs and build applications.

For example:

List<Announcement> announcements = new List<Announcement>();
SPSite site = SPContext.GetContext(HttpContext.Current).Site;
using (SPWeb curWeb = site.OpenWeb())
{
      SPList lstAnnouncements = curWeb.Lists[new Guid(LibraryName)];
 
      //rest of the code
}

Client Application

SharePoint Client Application

We use the SharePoint Web Services which then interacts with the SharePoint API. Usually, developers either build their own set of web services which exposes only certain methods/functions they want to expose to the application or consume the default out of the box SharePoint web services. This becomes difficult if you are going write rich client applications such as Silverlight, or Javascript applications and most of the time accessing SharePoint data via web services is complicated. That is why, I am not going to show you an example code!

The Future of SharePoint Client Applications

SharePoint 2010 introduces the new Client Object Model. From the sneak peak videos:

“The Client Object Model (OM) is a new programming interface for SharePoint 2010 where code runs on a user’s client machine against a local object model and interacts with data on the SharePoint Server. Client OM methods can be called from JavaScript, .NET code or Silverlight code and makes building rich client applications for SharePoint easy.”

So, how things are going to change?

Shareoint Client Application

One API to rule them all – Yep, whether its WPF or Windows Forms or Silverlight or Javascript – your code uses Client Object Model to interact with the SharePoint site to access the data. Now, there is something common that everybody can use instead of creating their own wrapper services to access SharePoint data!

Any code sample?

The only source of information available for now is the Developer Sneak Peak Video.

In the video, a Silverlight application is built using the Client Object Model.

The assemblies added to the project are:

Client Object Model

  • Microsoft.SharePoint.Client.Silverlight.dll
  • Microsoft.SharePoint.Client.Silverlight.Runtime.dll

And also there is a using statement added in the code behind:

Client Object Model

using Microsoft.SharePoint.Client;

And the code showcasing this new Client Object Model:

Client Object Model Code

You can explore the Microsoft.SharePoint.Client namespace in the SharePoint 2010 Technical Preview Documentation

Microsoft.SharePoint.Client namespace

Lets hope this Client Object Model simplifies accessing SharePoint data from client applications :)

Comments

8/19/2009 11:50:59 PM #

pingback

Pingback from cosier.wordpress.com

SharePoint 2010 Client Object Model «  Matthew Cosier’s Blog

cosier.wordpress.com | Reply

8/26/2009 2:37:57 AM #

trackback

SharePoint Development Weekly Roundup (25Aug)

TOP THIS WEEK  How I Benefit from Native Boot From VHD Reza Alirezaei's Blog

Confluence: SharePoint Development Wiki | Reply

9/1/2009 6:00:32 AM #

trackback

SharePoint 2007 resources - August 2009: Administration, WCMS and virtualization (Hyper-V)

SharePoint 2007 resources - August 2009: Administration, WCMS and virtualization (Hyper-V)

andreas glaser | Reply

9/26/2009 1:16:31 PM #

pingback

Pingback from changeq.wordpress.com

WPF Patterns, Frameworks and Practices  «  ChangeQ Blog

changeq.wordpress.com | Reply

12/10/2009 5:40:28 PM #

pingback

Pingback from ashwinbhagwat.wordpress.com

SharePoint 2010 – Client Object Model « Ashwin Bhagwat's Blog

ashwinbhagwat.wordpress.com | Reply

12/13/2009 7:04:39 AM #

Model

Nice intro to the client object model.

Model United States | Reply

3/11/2010 4:21:33 AM #

Praveen

Nice post,
I have written a detailed post on complete details of CLient Object Model in SharePoint 2010 here.

praveenbattula.blogspot.com/.../...ails-about.html

Praveen India | Reply

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



About the author




NZ SharePoint Conference 2010

 

 

New Zealand SharePoint User Group