How do I build a CAML query for this condition,

Status = "Current" (or) Status = "Outgoing" (and) Log Status = "Not Submitted"

@"<where><And><Or><Eq><FieldRef Name='Status'/><Value Type='Choice'>Current</Value></Eq><Eq><FieldRef Name='Status' /><Value Type='Choice'>Outgoing</Value></Eq></Or><Eq><FieldRef Name='CYQ1' /> <Value Type='Text'>Not Submitted</Value></Eq></And></where>"

This doesnt seem to work. Please advice.

1 Answer 1


Try this

@"<Where>" +
    "<And>" +
        "<Or>" +
            "<Contains><FieldRef Name=""Status""></FieldRef><Value Type=""Choice"">Current</Value></Contains>" +
            "<Contains><FieldRef Name=""Status""></FieldRef><Value Type=""Choice"">Outgoing</Value></Contains>" +
        "</Or>" +
        "<Eq>" +
            "<FieldRef Name='CYQ1' /><Value Type='Text'>Not Submitted</Value>" +
        "</Eq>" +
    "</And>" +

I have tested below using CAML Query Builder and it worked

       <Contains><FieldRef Name="Status" /><Value Type="Choice">Outgoing</Value></Contains>
       <Contains><FieldRef Name="Status" /><Value Type="Choice">Current</Value></Contains>
      <FieldRef Name="CYQ1" /><Value Type="Text">Not Submitted</Value>
  • It dint work Amal, I replaced <eq> with <Contains> like you did but all the items are being returned
    – user25284
    Oct 30, 2014 at 19:10
  • Can you update the question with complete code. How you are executing the CAML Query etc. Oct 30, 2014 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.