views:

58

answers:

1

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?

A: 

I don't believe there is.

SPSiteDataQuery targets 1 specific kind of content (i.e. list type) at a time.

When you need results from different kinds of content that, for instance, share a common custom field, create a managed property in Search (in the Shared Service Provider) and then use the FullTextSqlQuery class to query all content (which works cross site collection also, seeing as it is using the MOSS Search index).

Colin