0

I do not have a CAML Builder installed so just wanted to freehand this code. However I find that it is failing.

<View>
<Query>
    <Where>
        <And>
            <Leq>
            <FieldRef Name=\'StartDate\' />
            <Value Type=\'DateTime\'><Today />
            </Value>
            </Leq>
        </And>
        <And>
            <Eq>
            <FieldRef Name="_ModerationStatus" />
            <Value Type="ModStat">0</Value>
            </Eq>
        </And>
    </Where>
<OrderBy>
<FieldRef Name=\'StartDate\' Ascending=\'FALSE\'/>
</OrderBy>
</Query>
<RowLimit>1</RowLimit>

1 Answer 1

1
<View>
<Query>
    <Where>
        <And>
            <Leq>
               <FieldRef Name=\'StartDate\' />
               <Value Type=\'DateTime\'><Today />
               </Value>
            </Leq>          
            <Eq>
               <FieldRef Name="_ModerationStatus" />
               <Value Type="ModStat">0</Value>
            </Eq>
        </And>
    </Where>
<OrderBy>
<FieldRef Name=\'StartDate\' Ascending=\'FALSE\'/>
</OrderBy>
</Query>
<RowLimit>1</RowLimit>

Nesting of And condition was wrong.

Check my answer on how to write nested query

1
  • Accept it as answer if solves the issue. it might helps others
    – Gaurravs
    Nov 9, 2017 at 10:09

Your Answer

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

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