How to insert query value as parameter in sharepoint designer?
I am trying to create a data source in SharePoint Designer that connects to a SharePoint list via XML Web Services. I created a datasource and connected to the specified list. I can view all data using GetListItems and I want to filter it using a query parameter.
The request parameter takes an XmlNode, and when I put that as a value, I get the error:
<Query>
<Where>
<Eq>
<FieldRef Name="Title" />
<Value Type="Text">Foo</Value>
</Eq>
</Where>
</Query>
Of course, I haven't entered any tabs or new lines, since I only have a one-line input field in SharePoint Designer. I am getting an error with this request:
Server returned non-specific when trying to get data from a data source. Please check the format and content of your request and try again. If the problem persists, contact your server administrator.
I just want to filter the list of list results so that they are with a "Foo" header field. Can this be done in SharePoint Designer?
Update: escaping <and> this way also fails:
<Query><Where><Eq><FieldRef Name="Title" /><Value Type="Text">Foo</Value></Eq></Where></Query>
Update: This appears to be a known issue with SoapDataSource components and SOAP calls. Apparently they recode <and> before they are sent. A workaround is to save the data source without a query parameter and then add it to the page and create a filter in the Common Data View Tasks dialog box. I was able to get this to work using the following filter line:
[@ows_Title = 'Foo']
Unfortunately this doesn't help much as I am adding a Data View (showing data) and not a DataSource which I can use to specify other controls (like a dropdown).
I'm still looking for a good solution for this, which allows me to host the data source using SharePoint Designer.
source to share
There is a bug in SharePoint Designer. You cannot pass a Query object to a SOAPDataSource object like this - XML ββgets overencoded. There is nothing you can do to fix this, except by using Visual Studio.
I'll tell you if a fix is ββavailable.
If anyone wants to quote this answer in a new answer, I'll accept that answer.
source to share