0
votes

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.

1
As a sidenote, this library has helped me immensely when building CAML-queries: camlex.codeplex.comNiklas

1 Answers

0
votes

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))