Partilhar via


Querying from Client-side Code

Applies to: SharePoint Foundation 2010

This topic is a brief overview of about how to query data on a Microsoft SharePoint Foundation farm from a client application.

Querying from Client Code

There are four interfaces that client applications can use to retrieve data from SharePoint Foundation Web applications. Two of them are still supported for backward compatibility.

Queries in the Client Object Model

You can query within the client object model in two ways:

Client object model code is sent in batches to the front-end Web server for better performance. You can retrieve any kind of SharePoint Foundation data, not just list data. See SharePoint 2010 Client Object Model for more information.

Note

Silverlight applications use a Silverlight version of the client object model.

Using the ADO.NET Data Services Framework

If your client application does not use the new SharePoint Foundation client object model and you only need to query list data, you have the option of querying the content databases by using ADO.NET Data Services Framework. This framework enables you to work with list items that are strongly typed in a certain sense. For more information about this sense, see Query SharePoint Foundation with ADO.NET Data Services.

Avoid Using SharePoint Data-Providing Web Services

SharePoint Foundation has long provided a set of Web services to enable client interaction with SharePoint Foundation deployments. Some of these are specifically designed for data retrieval and others include some data retrieval services. Some of the most important of these Web services are the [Lists Web service], [Webs Web service], WebSvcsites, [SiteData Web service], and [DspSts Web service]. The APIs of these data-providing Web services are still supported for backward compatibility and interoperability with Web service clients. For reasons of both performance and ease, we recommend that you use either the client object model or the ADO.NET Data Services Framework to query SharePoint data.

Important

This advice is only about data-providing Web services. You will still use many of the ASMX Web services of SharePoint Foundation for other kinds of functionality.

Avoid Making Direct Calls to owssvr.dll

This SDK still documents client-side access to SharePoint Foundation deployments by using RPC calls only to provide troubleshooting assistance to existing client applications that make such calls. To maximize your new client application’s compatibility with future versions of SharePoint Foundation, we recommend that you do not use this method of client access.