I'm trying following CAML Query but it's not working correctly instead of returning 2 documents it's returning all .
<Where><And><Or><Eq><FieldRef Name='Participant' /><Value Type='User'>Project1, test</Value></Eq><Eq><FieldRef Name='Participant' /><Value Type='User'>Project2, test</Value></Eq></Or><Eq><FieldRef Name='Department' /><Value Type='Text'>Positioning</Value></Eq></And></Where>
I've tried testing in CAML Query builder but don't find any option to add two OR with one AND conditions like above.
My full query building code is,
strQuery1 = "<Where><And>";
strQuery1 +="<Or>";
foreach (string p in ParticipantNames)
{
strQuery1 += "<Eq><FieldRef Name='Participant' /><Value Type='User'>" + p + "</Value></Eq>";
}
strQuery1 +="</Or>";
strQuery1 += "<Eq><FieldRef Name='Department' /><Value Type='Text'>" + dept + "</Value></Eq></And></Where>";