I am querying a list with this CAML Query:
var camlQuery = @"<Query>
<Where>
<Eq>
<FieldRef Name='Title' />
<Value Type='Text'>MP Test</Value>
</Eq>
</Where>
</Query>";
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);
_clientContext.Load(list.Fields);
var camlQuery = new CamlQuery();
camlQuery.ViewXml = camlString;
var listItems = list.GetItems(camlQuery);
_clientContext.Load(listItems);
_clientContext.ExecuteQuery();
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.