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:

&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;Title&quot; /&gt;&lt;Value Type=&quot;Text&quot;&gt;Foo&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;

      


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.

0


source to share


4 answers


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.

+1


source


Have you coded XML request? I believe you need to encode characters like <,> and "so that it is valid XML, for example:

&lt;Query&gt;&lt;Where&gt;

      



and

&lt;FieldRef Name=&quot;Title&quot; /&gt;

      

+1


source


This shows how variables can be used to solve a similar problem.

+1


source


After working with the list title field it doesn't return a value for me unless I used Contains.

This may not fix your mistake.

0


source







All Articles