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
o This application resides in server
2. Writing a Client Application
o This client application can run from any other server or a desktop
How are we building these Server and Client applications today?
We interact with the Server Object Model, which are nothing but SharePoint APIs and build applications.
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
The Future of SharePoint Client Applications
SharePoint 2010 introduces the new Client Object Model. From the sneak peak videos:
So, how things are going to change?
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:
And also there is a using statement added in the code behind:
And the code showcasing this new Client Object Model:
You can explore the Microsoft.SharePoint.Client namespace in the SharePoint 2010 Technical Preview Documentation
What are the different Client OM supporting in the SharePoint 2010 API? [Client API]
- .NET Managed Client - Implemented in .NET CLR. I mean we use this in Web, Windows and Console applications.
- Silverlight Client - You can use the SharePoint objects in Silver light coding. Wow, this is going to be a huge advantage to the Silverlight applications which can be integrated into SharePoint. Before we don't have access to SharePoint objects inside Silverlight context.
Why Client Object Model comes into the picture? Are there any specialties of them?
The main started point to think by SharePoint team are as follows.
- Is it really necessary to have SharePoint installed on server for SharePoint development? - Yes, in SharePoint 2007 you have to install SharePoint on the server to write code and test it.
- What is the advantage of writing more web services to serve what the clients are looking for? - This is completely not a feasible solution to give or expose web services for each and every single requirement to get and manipulate data. It has plenty of limitations and if Microsoft exposes 500 web services and you didn't find what you really need and they are just waste. Instead write whatever you want and use them.
So, these things take into high priority and makes them to come up with a great solution in the form of Client Object Model. The great advantage of it is completely looks [Syntax] like the SharePoint Object Model. So, nothing new for developers and no confusion. Infact very simple to manage and write code.
SharePoint object model syntax:
Server side syntax
Client side syntax
Now, I believe you have understood the Client OM concept. Now, we will discuss a little bit about technical implementation.
SharePoint 2010 provides the client support files to refer the SharePoint objects and communicate with the SharePoint server. Below are the details.
DLL's needed : Microsoft.SharePoint.Client.dll, Microsoft.SharePoint.Client.Runtime.dll. Find these files in the 14/ISAPI folder. Usually, the location would be at "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI".
Microsoft.SharePoint.Client.Silverlight.dll and Microsoft.SharePoint.Client.Silverlight.Runtime.dll. They find at "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin".
SP.js file - The file fund at "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS".
Microsoft SharePoint Foundation 2010 installs Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\ISAPI for easy access in development. You must have both Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll to develop a solution remotely with the .NET managed object model. For a Windows Forms, Windows Presentation Foundation (WPF), or other application that calls the .NET managed SharePoint Foundation client APIs, to function, the client computer must have the SharePoint Foundation client DLLs installed. The client DLLs must be distributed with the application by using Microsoft's SharePoint Foundation 2010 Client Object Model Redistributable.
For an example that shows how to create a console application that uses the .NET managed object model, see Creating a Basic SharePoint Foundation Client Application.
For Silverlight client installations, Microsoft SharePoint Foundation 2010 deploys Microsoft.SharePoint.Client.Silverlight.dll and Microsoft.SharePoint.Client.Silverlight.Runtime.dll into the special scripts-only folder %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS\ClientBin. This folder is designed to be a standard place for hosting assemblies that are used in Silverlight. You must have both Microsoft.SharePoint.Client.Silverlight.dll and Microsoft.SharePoint.Client.Silverlight.Runtime.dll to develop a solution remotely with the Silverlight object model. The author of a Silverlight application can package the client-side DLLs together in the .xap file for download. It is also possible to cache the Silverlight DLLs.
For information about how to implement the SharePoint Foundation 2010 Silverlight object model in a Silverlight application, see Using the Silverlight Object Model.