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

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

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.