I want to return the events in an Event Calendar for the current week for a web page. I would prefer the current week Friday through Sunday, but that seemed too complicated.
When I use this code it returns events starting approximately 1 week from now and it's showing some events two months from now. I've tried using Week instead of the offset days and that didn't return anything. Would be happy just to get today + next seven days events. Any insight into this would be greatly appreciated. Please see query:

function getMyListData()
            var method = "GetListItems";                 
            var webURL =  $().SPServices.SPGetCurrentSite() ;                     
            var list = "Events Calendar";                      
            var fieldsToRead = "<ViewFields>"+"<FieldRef Name='Name' />" +"</ViewFields>";
            var query = "<Query><Where><Geq><FieldRef Name='EventDate' /><Value IncludeTimeValue='TRUE' Type='DateTime'><Today OffsetDays='7' /></Value></Geq></Where><OrderBy><FieldRef Name='EventDate' Ascending='True' /> </OrderBy></Query>";                       

1 Answer 1


Your query is just looking for any Event Date which is greater than or equal to today plus 7 days (so essentially you are looking at next week onwards). To simply show Event Dates for the next 7 days:

                <FieldRef Name='EventDate' />
                <Value IncludeTimeValue='TRUE' Type='DateTime'>
                    <Today OffsetDays='0' />
                <FieldRef Name='EventDate' />
                <Value IncludeTimeValue='TRUE' Type='DateTime'>
                    <Today OffsetDays='7' />
        <FieldRef Name='EventDate' Ascending='True' /> 
  • That worked great. Thx. But when I put the query on separate lines it never works. I amended your code to one line and put quotes around the whole thing and it worked. Do you know why, because it makes it really hard to read this way. Thanks!
    – Ginger22
    Aug 9, 2019 at 13: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.