0
         string query = <Where> 
                           <And>    
                              <And>       
                                 <And>          
                                      <Eq></Eq>
                                      <Eq></Eq>
                                 </And>
                                   <Geq></Geq>
                                   <Leq></Leq>
                              </And>       
                                <Eq></Eq>
                           </And>
                        </Where>

In SharePoint foundation development, i have used this CAML query to query a SharePoint list. This query contains five conditions. After above query gets executed, it throws an Microsoft.Sharepoint.SPException exception. I tried but couldn't figure it out. Is there any mistake in above CAML query. Any help is appreciated.

0

You have 3 child elements under the second And element: And, Geq and Leq. It is not supported. Wrap Geq and Leq elements with an additional And parent element and it will work.

Or, as suggested in other answers, use CAML query builder to generate your queries.

0

I'm in a hurry, to avoid errors in CAML query, try to build the query using CAML Query Builder.

Hope this helps you.

0

Please check your query. The below query I generated with U2U tool

<Where>
      <And>
         <And>
            <And>
               <Eq>

               </Eq>
               <Eq>

               </Eq>
            </And>
            <Eq>

            </Eq>
         </And>
         <Eq>

         </Eq>
      </And>
   </Where>

It should follow this format.

Download link for U2U and reference

http://www.u2u.be/Software

Where can i download the U2U CAML query Builder for Sharepoint 2010?

  • My query contains Five conditions. Furthermore your query contains four conditions, as i know it can be written with two ANDs. I think, three ANDs are not needed. – Nera Oct 30 '13 at 6:46
  • Why don't you use U2U Caml Query builder tool and verify the query. – Pushpendra Oct 30 '13 at 6:59
  • can u just send me a link to download U2U Caml Query builder tool. – Nera Oct 30 '13 at 7:10
  • I added it to the answer above...pls have a look. – Pushpendra Oct 30 '13 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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