SPSiteDataQuery limited to 10 document libraries work around

Technorati Tags:

 

In one of my last posts I talked about the limitations of using SPSiteDataQuery with more than 10 document libraries or lists. /smc750/archive/2007/07/24/spsitedataquery-limited-to-10-document-libraries-or-lists.aspx

 

Unfortunately, Microsoft has stated that this limitation cannot be fixed in the next service pack due to the fact that the fix would be in areas that are the core of WSS 3.0 code base. Any changes at this time present a significant risk of destabilizing the product. Microsoft has also stated that it will re-evaluate this bug again for service pack 2, however, there are no guarantees according to Microsoft. You will get incorrect or even erroneous results if you have more than 10 document libraries and lists combined in your site collection. The only way to get this class to work reliably is to limit which lists to search to 10 in your query. This can be done using the Lists property of the SPSiteDataQuery:

 

SPSiteDataQuery spq = new SPSiteDataQuery();

spq.Lists = "<Lists><List ID='c3ed3448-cbef-42cc-91b3-3cba89d28500' /></Lists>";

 

If you name more than 10 list ID's  then the WSS code will escalate to use a temporary table and produce incorrect results. The ability to use cross site searching in WSS is limited to 10 document libraries. Unfortunately, we cannot get Microsoft to publish the bug QFE19490 or a knowledge base article. Why?

Leave a Reply