SPQuery and SPSiteDataQuery in SharePoint

SPQuery and SPSiteDataQuery in SharePoint 2010
SPQuery - SPQuery can be used to query a single list.

SPQuery query = new SPQuery();

SPSiteDataQuery - It allows you to query from multiple lists whether it can be from a single-site or from that site and from sub sites.

SPSiteDataQuery query = new SPSiteDataQuery();

Both SPQuery and SPSiteDataQuery have Query property which accepts CAML query text.
For SPSiteDataQuery you may specify a scope. SPSiteDataQuery object has a property "Webs"
which defines the scope.

This property is described as "It specifies which web sites to include in the query as specified the scope attribute on the Webs tag in the query. By default, the query considers the current web site."

Like SPQuery you may put Row Limit in SPSiteDataQuery.

To know more about CAML Query, please visit my another blog post Learn CAML Query step by Step

CAML Query in SharePoint 2010

Protected by Copyscape

Comments

  1. Thanks for this blog. All screenshots can explain the full blogs easily. This is very easy to understand. Using this screen shots know the details becomes easy.
    Informatica Training in Chennai Mylapore

    ReplyDelete

Post a Comment

Dear Readers, Please post your valuable feedback in the comment section if you like this blog or if you have any suggestions. I would love to hear the same from you. Thanks

Popular

SharePoint Interview Questions and Answers

Calling ASP.Net WebMethod using jQuery AJAX

What is Cloud Computing - A guide for beginners