0

I am trying to get the data that matches my query but for some reason it just ignores the query and returns all the fields. My code is as follows. I am using Web services and the sharepoint server is 2003.

string queryString= "<In><FieldRef Name='Department' /><Values>";

string[] departments = txtDepartment.Text.Split(',');
for (int i = 0; i < departments.Length; i++)
{
    queryString += "<Value Type='Text'>"+departments[i]+"</Value>";
}
queryString += "</Values></In>";
query.InnerXml = queryString;
nodeListItems = mList.GetListItems(listName, guid, query, null, "5500", null, null);

Could you please advise me where am I going wrong. If I put at the begging and end it throws soap exception.

  • string queryString= "<In><FieldRef Name='Department' /><Values>"; string[] departments = txtDepartment.Text.Split(','); for (int i = 0; i < departments.Length; i++) { queryString += "<Value Type='Text'>"+departments[i]+"</Value>"; } queryString += "</Values></In>"; query.InnerXml = queryString; nodeListItems = mList.GetListItems(listName, guid, query, null, "5500", null, null); – Kam Nov 29 '13 at 15:02
  • Its the post that is not showing the complete code. I have pasted it. – Kam Nov 29 '13 at 15:02
1

The <In> element isn't supported prior to SharePoint 2010. See other versions in the SDK.

My guess is, that it was introduced in order to support querying for Managed Terms.

If the 2003 in the question is a typo then your issue may be missing the <Query>, <Where>, </Where> and </Query> elements

0

You're adding the closing

</In>

to the queryString, but it doesn't look like you're adding the starting

<In><Values>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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