Can SPSiteDataQuery search both List and Libraries?

Posted by Rich Bennema on Stack Overflow See other posts from Stack Overflow or by Rich Bennema
Published on 2010-05-05T19:23:25Z Indexed on 2010/05/05 19:28 UTC
Read the original article Hit count: 229

Filed under:
|

I have the following code:

SPSiteDataQuery query = new SPSiteDataQuery();
query.ViewFields = "<FieldRef Name=\"UniqueId\" />";
query.Webs = "<Webs Scope=\"SiteCollection\" />";
query.Query = "<Where<Eq><FieldRef Name='MyCustomField' /><Value Type='Boolean'>1</Value></Eq></Where>";
query.Lists = "<Lists BaseType=\"1\" />";
DataTable results = site.RootWeb.GetSiteData(query);

This searches all the Document Libraries in the site collection, but I want to search all the Lists as well. Is there a way to set the Lists property to search both at the same time?

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about sharepoint2007