Roland Oldengarm - Independent IT Contractor

Living in the coolest little capital Wellington, New Zealand!

SPSiteDataQuery: The property Query contains an invalid value.

Just ran into the following issue: created a big query, which was working fine. Made a minor change and ran into the following exception: The property Query contains an invalid value.]

 [SPException: The property Query contains an invalid value.]    
Microsoft.SharePoint.SPSiteDataQuery.ReportInvalidProperty(Exception ex, String strProperty) +118    
Microsoft.SharePoint.SPSiteDataQuery.ValidateXmlProperty(String strXml, String strPropertyName, String strTag, String strTag2, String strTag3) +366    
Microsoft.SharePoint.SPSiteDataQuery.get_ViewXml() +203    
Microsoft.SharePoint.SPWeb.GetSiteData(SPSiteDataQuery query) +394

This error normally indicates you made an XML-error, like not closing a <FieldRef>. That was not the case. I logged all query-parameters, copy-pasted to PowerShell and it was working like a charm there.

After spending hours I noticed that the Query-parameter started with a whitespace! After removing that, error was fixed…. So, no enters and/or white space at the start of the Query-parameter. It doesn’t matter how many you have inside the query, but nothing at the start.

1 Comment

  1. For me it was because i left in the query 🙁

Leave a Reply

Your email address will not be published.