Deciding Which SharePoint 2010 API to Use (Jim Crowley)
Update, July 12, 2011: See the MSDN version of this article: Deciding Which SharePoint 2010 API to Use.
Microsoft SharePoint 2010 provides three sets of APIs for developing extensions and custom solutions by using SharePoint capabilities: the server-side object model, the client object model, and Web services. Each API comes with a set of advantages and limitations that you will need to understand before you begin planning and developing custom solutions. For example, the server-side object model provides the most extensive set of options for developing customizations, but it can only be used on computers that are running a version of SharePoint 2010. The sections below describe the three sets of APIs and the contexts in which you will want to use them.
Server-side Object Model
The server-side object model provides the most extensive set of options for extending the capabilities of SharePoint 2010. It consists of every API that is documented in a Class Library contained inside the SharePoint 2010 Class Libraries and Web Service References section of the Microsoft SharePoint 2010 Software Development Kit (SDK).
Any application that uses these APIs must be physically deployed on the server. See Setting up the Development Environment for SharePoint 2010 on Windows Vista, Windows 7, and Windows Server 2008 for guidance on and options for setting up a development environment. In terms of security, these APIs usually have a high level of access, but see Sandboxed Solutions for code access security limitations that are related to sandboxed solutions. This set of APIs provides access to the largest number of features and capabilities. In Microsoft SharePoint Foundation 2010 many of the server-side APIs reside in the Microsoft.SharePoint assembly (Microsoft.SharePoint.dll), and in Microsoft SharePoint Server 2010 many of these APIs reside in the Microsoft.Office.Server assembly (Microsoft.Office.Server.dll). However, you must look at the documentation for each type and member in each API to know for sure which assembly to reference.
Client Object Model
The client object model allows you to integrate SharePoint 2010 capabilities into script that executes in the browser, code (no earlier than Microsoft .NET Framework 3.5) that executes in a .NET managed application, or code that executes in a Microsoft Silverlight 2.0 application. The APIs in the client object model are wrappers around a custom Web service that dispatches the calls to the server-side object model. They generally provide better performance than the SharePoint 2010 Web services because they batch requests and perform all operations asynchronously. The APIs in the client object model also feature design traits, such as object model hierarchy, object identity, data retrieval semantics, client context, infrastructural client objects, collections, and exception handling, that will be familiar to SharePoint 2010 developers, and to Microsoft ASP.NET developers more generally. SharePoint 2010 provides an unmanaged (ECMAScript) object model for script that executes in the browser. The unmanaged client object model (which supports Javascript and JScript) is a good option for Web developers who are not familiar with ASP.NET development. The client object model focuses on the most relevant APIs for client-side development, and does not contain all the types and members that are represented in the server-side object model.
The client object model is designed for use in remote client-side solutions that run on computers where SharePoint 2010 has not been installed. See SharePoint 2010 Client Object Model for more information about the client object model and how to use it. The types and members in these APIs are documented in Client Class Library (for code that executes in a .NET managed application or in a Microsoft Silverlight 2.0 application) and ECMAScript Class Library (for code that executes in the browser).
SharePoint 2010 Web Services
The SharePoint 2010 Web services allow you to integrate SharePoint capabilities into code that runs remotely in client-side or server-side applications that run on computers where SharePoint 2010 has not been installed. SharePoint 2010 provides a limited set of REST interfaces for developers who are familiar with that standard. The Web services provide a fuller range of capabilities than the managed client object model, but they do not provide the same performance and design advantages, such as batching and exception handling. When you develop client-side applications, you should use the managed client object model whenever possible.
The SharePoint 2010 Web services APIs are documented in SharePoint 2010 Web Services and in SharePoint Foundation REST Interface.
See Also
Setting up the Development Environment for SharePoint 2010 on Windows Vista, Windows 7, and Windows Server 2008
Sandboxed Solutions
Using the SharePoint Foundation Server-Side Object Model
Server and Site Architecture: Object Model
Comments
Anonymous
May 23, 2011
Jim, it seems that your links point to a local drive.Anonymous
May 24, 2011
The links are fixed now. I apologize for the mix-up.Anonymous
May 25, 2011
Thanks, Jim. As a long time web application developer but new to SharePoint (and .NET dev altogether) it's great to have this overview. Am I right in assuming then that the 2010 Web Services are the only one of relevance to those building for non-Microsoft platforms (Mac apps, iOS apps, other web applications)? Are they also the only one when working with the SharePoint Online (cloud) platform?Anonymous
May 25, 2011
Hi Myles. Your first assumption, about Web Services and non-Microsoft development platforms, is correct. As for SharePoint Online, I defer to our cloud expert A.J. May, who has passed along this helpful reply: "You can use all the API types in SharePoint Online, to varying degrees: • For server APIs, you can create sandbox solutions and upload them to SharePoint Online. • You can also use the client object models (ECMAScript, managed .NET and Silverlight) • Certain SharePoint Web services are also available in SharePoint Online, including the SharePoint REST service You can get a good overview of development options for SharePoint Online in the following article: SharePoint Online: An Overview for Developers (msdn.microsoft.com/.../gg153540.aspx) And you can find tons of detailed developer resources on the SharePoint Online Developer Resource Center: www.msdn.com/sharepointonline"Anonymous
September 01, 2011
As a guy looking to get into SharePoint development, this is actually a very useful article.Anonymous
March 15, 2012
Which client(s) can be used to connect to a user profile service on a different farm?