MS GRaph API - /users/{user AAID}/calendarView - fetching all day event for one day with - time range (23:59), give wrong results due expanding range for next day

Dariusz Niedzialek 1 Reputation point

There are 2 all-day events
1st. 2022-08-06
2nd. 2022-08-07

I'm preparing solution to get events from one day:
the problem is with time range, I don't understand why when I use hour 23:59:59 (endDateTime=2022-08-06T23:59:59) - the returned results contains 2nd day events too. It's look like timerange is corelated with user's timezone.
So when I change endDateTime to: 2022-08-06T21:59:59 the results are correct and contain only 1 event from requested day (1st day). The user's timezone is Eastern Standard Time (EST).

I'm still confused because changing user timezone (in outlook settings) doesn't impact on results.
How to get correct results?

Used query:$top=100&$skip=0&$select=categories,start,end,subject,isCancelled

RESULTS (shortened):
1st day task start end datetimes
"start": {
"dateTime": "2022-08-06T00:00:00.0000000",
"timeZone": "UTC"
"end": {
"dateTime": "2022-08-07T00:00:00.0000000",
"timeZone": "UTC"

2nd day task start end datetimes

        "start": {  
            "dateTime": "2022-08-07T00:00:00.0000000",  
            "timeZone": "UTC"  
        "end": {  
            "dateTime": "2022-08-08T00:00:00.0000000",  
            "timeZone": "UTC"  
Microsoft Graph Calendar API
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shivam Dhiman-MSFT 5,271 Reputation points Microsoft Vendor

    Hi @Dariusz Niedzialek

    To address your issue I have created 2 All day event in my test tenant. My outlook time zone is Eastern time. As per this documentation you have to use offset time to get the right result.

    You can use this*** Graph API.

    As you can see I am able to get both the events


    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.