Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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>
share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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>
share|improve this answer
    
@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 '13 at 16:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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