I am querying a list with this CAML Query:

var camlQuery = @"<Query>
                            <FieldRef Name='Title' />
                            <Value Type='Text'>MP Test</Value>
return _sharepoint.GetListItems(_masterListName, camlQuery);

Here is the code for GetListItems:

using (_clientContext = new ClientContext(Url))
    _clientContext.Credentials = _credentials;
    var web = _clientContext.Web;

    var list = web.Lists.GetByTitle(listName);

    var camlQuery = new CamlQuery();
    camlQuery.ViewXml = camlString;
    var listItems = list.GetItems(camlQuery);

    return listItems;

There is only 1 item on the list with the title MP Test, yet when I run this code I keep getting 38 entries in the listItems variable. I can see that the titles of those items are definitely not MP Test.. Wh am I getting these? Have I not sent off the query correctly?

I tried removing the Query tags as per this answer but with the same result.

Also tried adding "s around MP Test - same results.

Appreciate any guidance on this, thank you.

1 Answer 1


You are missing View as the root element in the CAML query. It should be:

var camlQuery = @"<View>
                        <FieldRef Name='Title' />
                        <Value Type='Text'>MP Test</Value>

Your Answer

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

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