I am querying a list to return only items matching a certain title, but the query returns all items. It seems I built or execute the query the wrong way:
/* SP is an alias for Microsoft.SharePoint.Client SP = using Microsoft.SharePoint.Client */ var list = clientContext.Web.Lists.GetByTitle(listTitle); SP.CamlQuery query = new SP.CamlQuery(); string qs = String.Format("<Query><Where><Eq><FieldRef Name=\"Title\"></FieldRef><Value Type=\"Text\">{0}</Value></Eq></Where></Query>", listItemTitle); query.ViewXml = qs; SP.ListItemCollection oCol = list.GetItems(query); clientContext.Load(oCol); clientContext.ExecuteQuery(); SP.ListItem item = oCol[0]; clientContext.Load(item, i => i.File); clientContext.ExecuteQuery(); Based on the query oCol should only contain 1 Item, since the titles are definitly unique, but it returns 58 results (all items) and therefor the item at oCol[0] is not the correct one.
Please note: I was getting the Item and file by Id before, but the client wants a way to enter an error-prone string, so I need to use CAML.
How can I correct this?