Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Sunday, November 18, 2012

Binding Data from Multiple SharePoint Lists using SpSiteDataQuery




      string strList = string.Empty;
strList += "<Lists>";
       strList += "<List ID='21248773-5E96-41CE-AB58-401BC564AE1D'/>";
       strList += "<List ID='4581B2C1-4775-42FD-9FEF-66B201A3BC4A'/>";
       strList += "<List ID='6B8DE688-BD5D-4ABC-A463-9639817CF571'/>";
      strList += "</Lists>";
       sQuery.Lists = strList;
       sQuery.ViewFields = "<FieldRef Name ='Title' />";
dgvMultipleListsData.DataSource = SPContext.Current.Web.GetSiteData(sQuery);
      dgvMultipleListsData.DataBind();

No comments:

Post a Comment