Question about SPSiteDataQuery
I want to look for "Published Documents" library in entire site collection and loop through. I found SPSiteDataQuery looks interesting but it needs serverTemplate id and if I pass 101 it will search all the document libraries but I want to restrict on specific library. How to do that ?
query.Lists = "<Lists Ser开发者_JS百科verTemplate=\"101\" />";
It will only search all the list libraries if you set:
SPSiteDataQuery query = new SPSiteDataQuery();
query.Webs = "<Webs Scope='SiteCollection' />";
or to get a recursive search:
query.Webs = "<Webs Scope='Recursive' />";
if you do not set the 'Webs' property it will just search the current Web (and list).
精彩评论