2

How to write a function to order by ascending: true for date field. There is a picture library in our site.

I find .OrderByDesc('year'), but I need it's opposite:

var query = new CamlBuilder()
        .View(['Title', 'Description', 'FileLeafRef','year']) 
        .Query().Where()
            .TextField('ContentType').EqualTo('EventsFolder')
            .OrderByDesc('year') //here
        .ToString()

Thank you.

1

just use OrderBy() this is Ascending (default sorting):

var query = new CamlBuilder()
        .View(['Title', 'Description', 'FileLeafRef','year']) 
        .Query().Where()
            .TextField('ContentType').EqualTo('EventsFolder')
            .OrderBy('year')
        .ToString()

Great POST here.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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