0

I am using CAML builder in SharePoint 2010 visual web part. But it is not working for And/Or combination.

Ex: I need to get the records from list based on Status=published or (Status=Draft and createdBy=currently logged in user) and AppName=SharePoint.

CAML query is not working for the above scenario. But for part of the above statement(below) is working.

Status=published or (Status=Draft and createdBy=currently logged in user)

Please let us know the solution which will work for And/Or combination in CAML query.

Thanks in Advance, Krishna Rao Maturi.

  • As a sidenote, this library has helped me immensely when building CAML-queries: http://camlex.codeplex.com/ – Niklas Jun 28 '13 at 15:06

1 Answers1

0

Work!!!

You may use 2 conditions only, to use more, you need use combination of conditions, example:

    <And>
         Condition A
         <or>
             Condition B
             Condition C
         <or>
    </And>

This equal this: (ConditionA && (ConditionB || ConditionC))

Diego Hillesheim
  • 165
  • 1
  • 2
  • 10