1

am trying to fetch taday's and upcomming events only from caml query in javascript but it is returning the one event of previous date alsocaml Query is as bellow

query.set_viewXml('<View> <Query> <Where> <DateRangesOverlap> <FieldRef Name="EventDate" /> <FieldRef Name="EndDate"/>  <Value Type="DateTime"> <Now /> </Value> </DateRangesOverlap> </Where> <OrderBy> <FieldRef Name="EventDate"/> </OrderBy> </Query></View>');

it's result is as like
enter image description here

1 Answer 1

2

Your query returning 1 result from past since you have used not added greater than equals to condition with Today

Try below query:

query.set_viewXml('<View><Query><Where><DateRangesOverlap><FieldRef Name="EventDate" /><Geq><FieldRef Name="EndDate"/><Value Type="DateTime"><Now /></Value></Geq></DateRangesOverlap></Where><OrderBy><FieldRef Name="EventDate"/></OrderBy></Query></View>');
7
  • sorry that was my fault that i have posted the wrong query which i was trying to see some other result,but now i have changed that in question
    – Madhav
    Commented Sep 30, 2016 at 6:56
  • and when am passing the query as you have mensione it returns on theevent of 29th sept(previous dates that current date)
    – Madhav
    Commented Sep 30, 2016 at 6:58
  • how many items you have in list ?
    – Gaurravs
    Commented Sep 30, 2016 at 6:58
  • code updated, try this
    – Gaurravs
    Commented Sep 30, 2016 at 7:02
  • see here i.sstatic.net/hrVnj.png
    – Madhav
    Commented Sep 30, 2016 at 7:03

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.