Try to use your CAML in below format:
<View>
<Query>
<Where>
<Eq>
<FieldRef Name='Invoice_Category'/>
<Value Type='Text'>Service</Value>
</Eq>
</Where>
</Query>
</View>
Note:
- In CAML query you need to use internal name of your column/field.
Find the internal name of SharePoint column
Complete Code:
string siteUrl = "http://tenant.sharepoint.com/sites/SiteName";
ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("ListName");
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><Query><Where><Eq><FieldRef Name='Invoice_Category'/><Value Type='Text'>Service</Value></Eq></Where></Query></View>";
ListItemCollection collListItem = oList.GetItems(camlQuery);
clientContext.Load(collListItem);
clientContext.ExecuteQuery();
foreach (ListItem oListItem in collListItem) {
Console.WriteLine("ID: {0} \nTitle: {1}", oListItem.Id, oListItem["Title"]);
}
Update from Comments:
Also, from the screenshot you attached in your question, I can see that the value in your column is "Service Invoice" and not just "Service". So in that case you might need to use Contains
instead of Eq
. check below query:
<View>
<Query>
<Where>
<Contains>
<FieldRef Name='Invoice_Category'/>
<Value Type='Text'>Service</Value>
</Contains>
</Where>
</Query>
</View>
Reference: Query schema.