2

It seems my following query is failing and throwing "Cannot complete this action".However when I test this query in CAML Query builder it's working fine.

<Where>
    <And>
       <Or>
         <Eq><FieldRef Name='Participant' /><Value Type='User'>Test1</Value></Eq>
         <Eq><FieldRef Name='Participant' /><Value Type='User'>Test2</Value></Eq>
         <Eq><FieldRef Name='Participant' /><Value Type='User'>Test3</Value></Eq>
        </Or>
      <Eq><FieldRef Name='Department' /><Value Type='Text'>Positioning</Value></Eq>
     </And>
 </Where>

1 Answer 1

6

And and Or elements have exactly 2 children. Your Or statement needs to be rephrased as

<Or>
  <Eq><FieldRef Name='Participant' /><Value Type='User'>Test1</Value></Eq>
  <Or>
     <Eq><FieldRef Name='Participant' /><Value Type='User'>Test2</Value></Eq>
     <Eq><FieldRef Name='Participant' /><Value Type='User'>Test3</Value></Eq>
  </Or>
</Or>
1
  • @Igaud, Thanks.. I'm generating query dynamically and my <OR> condition can increase up to any limit.What's the best way to arrange ?
    – Rishi
    Apr 3, 2013 at 16:48

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.