What's New: Query Enhancements

SharePoint 2010

Last modified: April 12, 2010

Applies to: SharePoint Foundation 2010

Microsoft SharePoint Foundation 2010 includes several new ways to query and filter data.

Querying data in server code has become significantly easier and more powerful in SharePoint Foundation 2010.

LINQ to SharePoint Provider

When your code needs to query list data, it is no longer necessary to compose a Collaborative Application Markup Language (CAML) query. SharePoint Foundation 2010 includes a LINQ to SharePoint provider to enable your code to query SharePoint lists from server code by using LINQ syntax. The provider translates your LINQ queries into CAML queries for submission to the content database. Because SharePoint Foundation 2010 also adds a new Join element to the Query Schema, you can have both implicit and explicit joins in your LINQ queries by using the join keyword. (See "List Joins Supported in CAML Queries" below.) You can also write to the lists by using the provider. As always with a LINQ provider, you must have classes that provide an object-oriented interface over the relational content databases. These classes are generated for you by the SPMetal tool that is included with SharePoint Foundation 2010. For more information about the LINQ to SharePoint provider, see Managing Data with LINQ to SharePoint. For more information about SPMetal, see SPMetal.

You can use LINQ syntax in your code even if you are not using the LINQ to SharePoint provider. Any SharePoint Foundation object that implements IEnumerable<T> can be queried with LINQ syntax. For more information, see LINQ to Objects.

List Joins Supported in CAML Queries

You can now join multiple lists in a single query with the new Join Element (View). Use the new ProjectedFields Element (View) element to specify what list fields to include in the results. There are some details that need to be considered when using these elements. For more information, see List Joins and Projections.

There have been dramatic changes in the way that client applications access SharePoint Foundation data.

Queries in the Client Object Model

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

Support for 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.

Avoid Using SharePoint Data Providing Web Services

Earlier versions of the SharePoint Foundation product have provided a set of Web services to enable client interaction with SharePoint Foundation deployments. Some of these services, such as List Data Retrieval Web Service, are still supported, in order to provide backward compatibility and interoperability with Web service clients. For best performance and usability, we recommend that you use either the client object model or the ADO.NET Data Services Framework.

Avoid Making Direct Calls to owssvr.dll

The Microsoft SharePoint Foundation 2010 Software Development Kit (SDK) still includes documentation about client side access to SharePoint Foundation deployments by using RPC calls, but this information is included 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 make direct calls to the owssvr.dll file as a method of client access.

Show:
© 2014 Microsoft