I'm trying to perform a CAML Query test and display the results.

For example I'll be using two columns in a list; one called StartDate another called EndDate.

Currently, I've a CAML Query that orders the StartDate column and displays the first five items in the list.

    CAMLQuery: "<Query><OrderBy><FieldRef Name='StartDate' Ascending='True'/></OrderBy></Query>",
    CAMLRowLimit: 5, 

What I need to do is to write something that will look at the EndDate column and make a comparison to today's date. If that date has already passed it shouldn't turn up in the results.

Therefore, the 5 list items appearing will not have an EndDate that has already passed.

  • Take a look at sharepoint.stackexchange.com/questions/49433/… The <WHERE> snippet at the very top of the page might be really close to what you need - I believe you'll need to place it here in your Query <Query><OrderBy /><Where /></Query>
    – Hutch
    Jan 8, 2016 at 1:01

1 Answer 1


You will need to add where condition and use <Today> token in your caml query. The query will be like as below

    <FieldRef Name='StartDate' Ascending='True'/>
        <FieldRef Name='EndDate' /><Value Type='DateTime'><Today /></Value>

Reference: http://www.sharepoint-tips.com/2009/06/using-today-token-in-caml-query.html

  • Perfect! I just modified the Today value to include the future 10 days as well. <Today OffsetDays="5" /> Works like a charm. Much appreciated! Jan 8, 2016 at 14:27

Your Answer

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

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