Data Access for Client Applications

In the previous version of SharePoint products and technologies, your options for accessing data from client applications were largely limited to the SharePoint ASP.NET Web services. The lack of a strongly-typed object model and the need to construct complex Collaborative Application Markup Language (CAML) queries in order to perform simple data operations made the development of SharePoint client applications challenging and somewhat limited. SharePoint 2010 introduces several new data access mechanisms that make it easier to build rich Internet applications (RIAs) that consume and manipulate data stored in SharePoint. There are now three principal approaches to accessing SharePoint data from client applications:

  • The client-side object model. The client-side object model (CSOM) consists of three separate APIs that provide a subset of the server-side object model for use in client applications. The ECMAScript object model is designed for use by JavaScript or JScript that runs in a Web page, the Silverlight client object model provides similar support for Silverlight applications, and the .NET managed client object model is designed for use in .NET client applications such as WPF solutions.
  • The SharePoint Foundation REST interface. The SharePoint Foundation Representational State Transfer (REST) interface uses WCF Data Services (formerly ADO.NET Data Services) to expose SharePoint lists and list items as addressable resources that can be accessed through HTTP requests. In keeping with the standard for RESTful Web services, the REST interface maps read, create, update, and delete operations to GET, POST, PUT, and DELETE HTTP verbs respectively. The REST interface can be used by any application that can send and retrieve HTTP requests and responses.
  • The ASP.NET Web Services. SharePoint 2010 continues to expose the ASMX Web services that were available in SharePoint 2007. Although these are likely to be less widely used with the advent of the CSOM and the REST interface, there are still some scenarios in which these Web services provide the only mechanism for client-side data access. For future compatibility, use CSOM and REST where possible.

Note

In addition to these options, you can develop custom Windows Communication Foundation (WCF) services to expose SharePoint functionality that is unavailable through the existing access mechanisms. For more information about this approach, see WCF Services in SharePoint Foundation 2010 on MSDN.

The product documentation for SharePoint 2010 includes extensive details about each of these approaches, together with examples and walkthroughs describing approaches to common client-side data access requirements. This documentation focuses on the merits and performance implications of each approach for different real-world scenarios, and it presents some guidance about how to maximize the efficiency of your data access operations in each case. Before you start, you need a broad awareness of the capabilities of each approach. The following table shows what you can do in terms of data access with the CSOM, the REST interface, and the ASP.NET Web services.


CSOM

REST interface

Web services

List queries

Ff798473.c40206f5-eb65-4c7e-817c-0fb0db45c5e3(en-us,PandP.10).png

Ff798473.5c044c4f-25c9-4694-a6be-2c75463019be(en-us,PandP.10).png

Ff798473.77ea8f26-8f7a-4087-862e-f81dd7978a15(en-us,PandP.10).png

List join queries

Ff798473.4f4e7d0f-b153-4a18-b92a-b10bbb9cfc6d(en-us,PandP.10).png

Ff798473.b04f0d07-1d2c-491c-8ebd-f8da1dc6c6d7(en-us,PandP.10).png*


External list queries

Ff798473.101541ae-dfa5-457d-bc79-3cddda160b53(en-us,PandP.10).png



View projections

Ff798473.f95dc899-6bf5-4e35-9869-fb882a840290(en-us,PandP.10).png

Ff798473.52298f60-e9c9-40a4-b22e-88e0e41404c9(en-us,PandP.10).png

Ff798473.c13cafdd-7995-4ba5-9554-98285f82e59c(en-us,PandP.10).png

Request batching

Ff798473.d9ef7585-a642-4536-a5b7-04fdeba712e9(en-us,PandP.10).png

Ff798473.d2b97d8c-6b45-43aa-b2ae-0ff9ba5d14af(en-us,PandP.10).png


Synchronous operations

Ff798473.a10bef38-86bf-4d93-98c4-d6b9c91e4623(en-us,PandP.10).png (except ECMA)


Ff798473.679fbf9f-4b05-4428-8c30-f1818e7bc7f4(en-us,PandP.10).png

Asynchronous operations

Ff798473.57536533-1346-470f-8c72-e3f3bea988ec(en-us,PandP.10).png

Ff798473.ffe08c49-cf71-4c80-95a1-73ffa53c0db0(en-us,PandP.10).png

Ff798473.aeca887e-179b-493e-bd09-a52d5bf6f82c(en-us,PandP.10).png

SharePoint Foundation object model access

Ff798473.3049ce3f-1264-4e34-9430-19e22af47692(en-us,PandP.10).png



Access to SharePoint Server functionality (beyond SharePoint Foundation)



Ff798473.afe36e98-f80a-40b0-af69-6403b7fd163c(en-us,PandP.10).png

Support non-Windows clients

Ff798473.9d770af0-f075-4b41-8d85-194401fd635b(en-us,PandP.10).png (ECMA only)

Ff798473.e8e0b274-044e-4e87-a1f4-9613ffdf90ab(en-us,PandP.10).png

Ff798473.ca484dfa-24a4-42a6-8f2d-800e76a87565(en-us,PandP.10).png

Support strongly-typed LINQ queries

Ff798473.d31d849d-79ae-4d7a-a9d0-19107cb17cd2(en-us,PandP.10).png (objects only, no list queries)

Ff798473.69e28530-8e6e-40fe-b4bd-98406c229529(en-us,PandP.10).png (with proxy, lists only)


*The REST interface will perform implicit list joins, but only to satisfy where clause evaluation.

This section includes the following topics:

  • Using the Client Object Model. This topic describes the capabilities, performance, and limitations of accessing data using the CSOM.
  • Using the REST Interface. This topic describes the capabilities, performance, and limitations of accessing data using the SharePoint REST interface.

Because the ASP.NET Web services exposed by SharePoint 2010 work in the same way as the previous release, they are not covered in detail here. Generally speaking, you should prefer the use of the CSOM or the REST interface over the ASP.NET Web services when they meet your needs. However, the Web services expose some advanced data, such as organization profiles, published links, search data, social data, and user profiles, which is unavailable through the CSOM or the REST interface. For more information about the ASP.NET Web services exposed by SharePoint 2010, see SharePoint 2010 Web Services on MSDN.

Note

There are also scenarios in which you may want to use the client-side APIs to access data from server-side code. Although the CSOM, the REST interface, and the SharePoint ASP.NET Web services are all available when you develop server-side code, the use of these APIs in server-side code is only recommended for accessing data from another farm. Using the server-side object model is more efficient than using any of the client-side APIs.