What to do when you try to execute a SPSiteDataQuery and sharepoint returns this error message: "The query cannot be completed because the number of lists in the query exceeded the allowable limit".

You should, 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.

You can also use the MaxListLimit on the SPSiteDataQuery.Lists like this <Lists BaseType='850' MaxListLimit='0'/>. This will search all lists in the entire site.

Not specifying a MaxListLimit would only search 1000 lists, but throw an error if there are more than 1000 lists. If you are no sure that the client will have less than 1000 lists I recommend you to use the '0'.

LEAVE A REPLY

Please enter your comment!
Please enter your name here