Creation of all day event using Graph >> shifted events when viewing calendars from other users in Outlook (timezone issue)

costa 21 Reputation points
2023-01-05T12:42:30.157+00:00

Hello,

We have an application that writes all day events, using Graph, to a user's calendar.

The target of the POST is "/users/<email-of-user>/calendar/events".

The payload of our POST is the following:

{  
    "subject" : "<subject>",  
    "body" : {  
        "contentType" : "text",  
        "content" : "<message>"  
    },  
    "isAllDay" : true,  
    "isReminderOn" : false,  
    "transactionId" : "<unique_id>",  
    "showAs" : "free",  
    "originalStartTimeZone" : "UTC",  
    "originalEndTimeZone" : "UTC",  
    "start" : {  
        "dateTime" : "<YYYY-MM-DD_of_all_day_event>T00:00:00.0000000",  
        "timeZone" : "UTC"  
    },  
    "end" : {  
        "dateTime" : "<YYYY-MM-DD_of_all_day_event+1>T00:00:00.0000000",  
        "timeZone" : "UTC"  
    },  
    "location" : {  
        "displayName" : "<location>"  
    }  
}  

The POST has been built taking into account information from the Graph documentation:

  • isAllDay set to true ( reference )
  • "start" and "end" dateTimeTimeZone set to midnight and in the same timezone ( reference )
  • "originalStartTimeZone" and "originalEndTimeZone" set to UTC as well (due to the source of the event creation being a system running in UTC).

I have also adapted the POST above taking into account information from some links:

The result of the above POST call is the following:

  • For the user whose calendar we are writing to, independently of the timezone of that user, all is OK: the event is correctly set to allDay, and is displayed in the Outlook calendar correctly
  • For users, whose timezone is UTC, which are viewing other users calendars, independently of the timezone of the target user, all is OK: the event is correctly set to allDay, and is displayed in the Outlook calendar correctly
  • For users, whose timezone is not UTC, which are viewing other users calendars, independently of the timezone of the target user, a problem exists: the calendar of the target user's all day events are shifted in the amount of Hours between UTC and the target user timezone

In summary:

  • All is OK for the self user's calendar, independently of timezone
  • Not OK when viewing other users calendars if the self user in not in UTC

The image below tries to visually explain the issue:

  • The same 3 users, and how other users are viewed from their perspective

276506-problem-graph-full.png

After searching online (the links posted above) and the documentation, I cannot seem to find a clear path forward to solve the problem once and for all, which is guarantee all day consistent events when viewing other user's calendars, independently of timezone.

Would really appreciate any tips in the right direction.

Thanks in advance.

Microsoft Graph Calendar API
No comments
{count} votes