You have not specified the what the field should contain.
For example, if the field name is country and you are searching for all countries named belgium, you need to put that in the query.
Replace the ViewXml
as below. You need to add <View>
and the condition as well:
camlQuery.ViewXml = "<View><Query><Where><Eq><FieldRefName='" + fieldInternalName + "'/><Eq><Value Type='Text'>Belgium</Value></Eq></Where></Query></View>";
Your code should be as below:
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><Query><Where><Eq><FieldRefName='" + fieldInternalName + "'/><Eq><Value Type='Text'>Belgium</Value></Eq></Where></Query></View>";
var itemColl = list.GetItems(camlQuery);
clientContext.Load(itemColl);
clientContext.ExecuteQuery();
var count = itemColl.Count;
Updated as per comment:
You need to write below code:
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><RowLimit>100</RowLimit></View>";
ListItemCollection listItems = oList.GetItems(camlQuery);
clientcontext.Load(listItems, items => items.Include(
item => item["Country"]));
clientContext.ExecuteQuery();
var count = listItems.Count;
In the load()
method, you need to specify the Internal column name.