i am using a caml query to check if a specific value exist in a sharepoint list. but it ends up returnning all the values instead of one.
while (reader.Read())
{
// MessageBox.Show(reader[5].ToString());
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml =
@"<Query>
<Where>
<Eq>
<FieldRef Name='Email_x0020_Address' />
<Value Type='Text'>[email protected]</Value> </Eq></Where></Query>";
ListItemCollection listItems = myList.GetItems(camlQuery);
ctx.Load(
listItems
);
ctx.ExecuteQuery();
if (listItems.Count != 0)
{
MessageBox.Show("Item Exists");
foreach (ListItem listItem in listItems.ToList())
{
MessageBox.Show(listItem["Email_x0020_Address"].ToString());
}
}
else
{
MessageBox.Show("Item Does not exists");
}