I am running the following SPSiteDataQuery. The query was working, but only started throwing the SPException after I added an already existing managed metadata site column to the Documents library. I'm not sure if this was the only change in the environment, but is all I can think of that's changed. I've since removed the site column from the library, and all documents in the library, but it is still throwing the exception.

To be clear, the query works when querying all lists (base type 0), but throws the SPException when querying libraries (base type 1):

var query = new SPSiteDataQuery {
            Query = string.Format(@"<Where><Eq><FieldRef Name='TaxCatchAll' LookupId='TRUE' /><Value Type='Lookup'>{0}</Value></Eq></Where>", wssId),
            Lists = string.Format("<Lists BaseType='{0}' />", baseType),
            ViewFields = @"<FieldRef Name='ID' Nullable='TRUE' /><FieldRef Name='UniqueId' Nullable='TRUE' /><FieldRef Name='LinkFilename2' Nullable='TRUE' /><FieldRef Name='Title' Nullable='TRUE' Type='text' /><FieldRef Name='FileRef' Nullable='TRUE' /><FieldRef Name='EncodedAbsUrl' Nullable='TRUE' /><FieldRef Name='Resource_x0020_Types' Nullable='TRUE' /><FieldRef Name='FAQ_x0020_Category' Nullable='TRUE' />",
            Webs = "<Webs Scope='SiteCollection'/>"

Here are the details of the exception:

[Microsoft.SharePoint.SPException]: {""}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: {"<nativehr>0x80131904</nativehr><nativestack></nativestack>"}
Message: ""
Source: "Microsoft.SharePoint"
StackTrace: "   at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)\r\n   at Microsoft.SharePoint.Library.SPRequest.CrossListQuery(String bstrUrl, String bstrXmlWebs, String bstrXmlLists, String bstrXmlQuery, ISP2DSafeArrayWriter pCallback, Object& pvarColumns)\r\n   at Microsoft.SharePoint.SPWeb.GetSiteData(SPSiteDataQuery query)\r\n   at PROJ.DataAccess.RelatedContentDA.QuerySite(Int32 wssId, Int32 baseType)"
TargetSite: {Void HandleComException(System.Runtime.InteropServices.COMException)}

5 Answers 5


You'll probably also notice the following error in your WFE's event log:

The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100

I experienced the same error and it was related to a query that was too resource intensive. Actually SharePoint will retrieve all lists of that basetype and use it in a next stored procedure to retrieve the requested listitems.

Some steps can be followed to get rid of annoying and not-so-self-explaining error.

  1. Go to Resource Throttling settings for your Web Application and raise all your thresholds.
  2. If that works, try to be more specific in your query.
    • Use ServerTemplate which tends to return less results than BaseType
    • For instance you could add all list Guids of the document library you want to query.
    • Use MaxListLimit attribute.
  3. Restore your Resource Throttling settings and test again


<Lists ServerTemplate='101' MaxListLimit='100'><List ID='{76CA01E5-13AF-4A0E-A726-2F10B2EB4832}'/><List ID='{1FB2301A-359D-49BC-8484-8AECE58CD248}'></Lists> 

Hope this helps...


I saw this error once and it was related to a lack of permissions on one of the sites within the scope of the query. Make sure the user/service account context that the query is running within has access to all the site(s) within the scope of the query.


In your Viewfields, you have <FieldRef Name='Title' Nullable='TRUE' Type='text' />, the 'type' must have Text with a capital T.

  • Thanks James, but this isn't necessary (at least not in my testing, or my implementation). Changing it to capital T does not remove the exception. If this was the problem, I would expect the query to fail on list base types too and not just library base types.
    – blackf0rk
    Commented Jun 24, 2011 at 16:58
  • Ah, understood. Does it work when trying BaseType 1 with no Query in place?
    – James Love
    Commented Jun 24, 2011 at 17:01
  • Passing in a blank query throws the same exception on the list base type now too. Interesting.
    – blackf0rk
    Commented Jun 24, 2011 at 17:18

You could try adding the ServerTemplate attribute to the Lists element, it's 101 for doc libs


I had the same Exception. In my case I had FieldRefs with Url field:

<FieldRef Name="UrlField" Nullable="True" />

And problem was that I didn't specify Type parameter. Next code sample works for me.

<FieldRef Name="UrlField" Nullable="True" Type='URL' />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.