This project is read-only.

What's new webpart throws error when query returns more than 1000 lists with content


When a site contains more than 1000 lists which all holds data within the specified timeframe and is classified as new, the webpart throws the following error: "The query cannot be completed because the number of lists in the query exceeded the allowable limit. For better results, limit the scope of the query to the current site or list or use a custom column index to help reduce the number of lists.". This is caused by the fact that the Lists property of the SPSiteDataQuery object is formatted incorrectly.
q.Lists = string.Format("<Lists BaseType='{0}' MaxListsLimit='{1}'/>", baseType.ToString(),this.MaxLists.ToString());
should be:
q.Lists = string.Format("<Lists BaseType='{0}' MaxListLimit='{1}'/>", baseType.ToString(), this.MaxLists.ToString());
Check differences between MaxListLimit. Also check blog below for clarification:
Martijn Duiveman