Start and end times of all day events fetched from Graph API are not in the correct time zone

Wasif Samad 16 Reputation points
2023-09-20T07:13:19.85+00:00

I created an all-day event in my GMT+5 calendar for Sept 30. It spans the whole Sept 30.

When I fetch this event from the Graph API, I get the start date as the start of Sept 30, and the end date as the start of Oct 1 in UTC. This time is obviously not in UTC and is incorrect. Our app works using the UTC time zone and this bug is messing things up. Does anybody know when it will get fixed and a workaround for this?

The following is the event object:

"createdDateTime": "2023-09-20T06:02:12.3726894Z",
    "lastModifiedDateTime": "2023-09-20T06:07:29.7537414Z",
    "changeKey": "IloTFbAhCkiHTVTwnI2TXQABdhI/3Q==",
    "categories": [],
    "transactionId": "ca0c9f61-e663-f79d-b93c-f172db6bde3d",
    "originalStartTimeZone": "UTC",
    "originalEndTimeZone": "UTC",
    "iCalUId": "040000008200E00074C5B7101A82E00800000000EF9B7EFF87EBD901000000000000000010000000C40FFE16D32F0C4E839D06014AEA7503",
    "reminderMinutesBeforeStart": 420,
    "isReminderOn": true,
    "hasAttachments": false,
    "subject": "all day busy",
    "bodyPreview": "",
    "importance": "normal",
    "sensitivity": "normal",
    "isAllDay": true,
    "isCancelled": false,
    "isOrganizer": true,
    "responseRequested": true,
    "seriesMasterId": null,
    "showAs": "busy",
    "type": "singleInstance",
    "webLink": "https://outlook.office365.com/owa/?itemid=AQMkADI2ZDFmNDY4LTJlOWItNGVhOS1iM2E1LWZhMzg5ZDQ1MGUwNgBGAAADhQrIuhuED0%2BHAi76F3pFqAcAIloTFbAhCkiHTVTwnI2TXQAAAgENAAAAIloTFbAhCkiHTVTwnI2TXQABds%2BCOQAAAA%3D%3D&exvsurl=1&path=/calendar/item",
    "onlineMeetingUrl": null,
    "isOnlineMeeting": false,
    "onlineMeetingProvider": "unknown",
    "allowNewTimeProposals": true,
    "occurrenceId": null,
    "isDraft": false,
    "hideAttendees": false,
    "responseStatus": {
        "response": "organizer",
        "time": "0001-01-01T00:00:00Z"
    },
    "body": {
        "contentType": "html",
        "content": ""
    },
    "start": {
        "dateTime": "2023-09-30T00:00:00.0000000",
        "timeZone": "UTC"
    },
    "end": {
        "dateTime": "2023-10-01T00:00:00.0000000",
        "timeZone": "UTC"
    },
    "location": {
        "displayName": "",
        "locationType": "default",
        "uniqueIdType": "unknown",
        "address": {},
        "coordinates": {}
    },
    "locations": [],
    "recurrence": null,
    "attendees": [],
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,828 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Wasif Samad 16 Reputation points
    2023-09-25T15:44:30.08+00:00

    Hi CarlZhao-MSFT,

    I have been using the Prefer header. No matter what time zone I set the start and end times are the same, and it is in my calendar's local time. That is GMT+5 for any time zone set I get the same start and end time.

    The following is the event in outlook.timezone="Central Standard Time"

    Response:

    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('36e3c7fc-1c36-41a0-9545-fe8480386523')/events/$entity",
        "@odata.etag": "W/\"IloTFbAhCkiHTVTwnI2TXQABdhI/3Q==\"",
        "id": "AQMkADI2ZDFmNDY4LTJlOWItNGVhOS1iM2E1LWZhMzg5ZDQ1MGUwNgBGAAADhQrIuhuED0_HAi76F3pFqAcAIloTFbAhCkiHTVTwnI2TXQAAAgENAAAAIloTFbAhCkiHTVTwnI2TXQABds_COQAAAA==",
        "createdDateTime": "2023-09-20T06:02:12.3726894Z",
        "lastModifiedDateTime": "2023-09-20T06:07:29.7537414Z",
        "changeKey": "IloTFbAhCkiHTVTwnI2TXQABdhI/3Q==",
        "categories": [],
        "transactionId": "ca0c9f61-e663-f79d-b93c-f172db6bde3d",
        "originalStartTimeZone": "Central Standard Time",
        "originalEndTimeZone": "Central Standard Time",
        "iCalUId": "040000008200E00074C5B7101A82E00800000000EF9B7EFF87EBD901000000000000000010000000C40FFE16D32F0C4E839D06014AEA7503",
        "reminderMinutesBeforeStart": 420,
        "isReminderOn": true,
        "hasAttachments": false,
        "subject": "all day busy",
        "bodyPreview": "",
        "importance": "normal",
        "sensitivity": "normal",
        "isAllDay": true,
        "isCancelled": false,
        "isOrganizer": true,
        "responseRequested": true,
        "seriesMasterId": null,
        "showAs": "busy",
        "type": "singleInstance",
        "webLink": "https://outlook.office365.com/owa/?itemid=AQMkADI2ZDFmNDY4LTJlOWItNGVhOS1iM2E1LWZhMzg5ZDQ1MGUwNgBGAAADhQrIuhuED0%2BHAi76F3pFqAcAIloTFbAhCkiHTVTwnI2TXQAAAgENAAAAIloTFbAhCkiHTVTwnI2TXQABds%2BCOQAAAA%3D%3D&exvsurl=1&path=/calendar/item",
        "onlineMeetingUrl": null,
        "isOnlineMeeting": false,
        "onlineMeetingProvider": "unknown",
        "allowNewTimeProposals": true,
        "occurrenceId": null,
        "isDraft": false,
        "hideAttendees": false,
        "responseStatus": {
            "response": "organizer",
            "time": "0001-01-01T00:00:00Z"
        },
        "body": {
            "contentType": "html",
            "content": ""
        },
        "start": {
            "dateTime": "2023-09-30T00:00:00.0000000",
            "timeZone": "Central Standard Time"
        },
        "end": {
            "dateTime": "2023-10-01T00:00:00.0000000",
            "timeZone": "Central Standard Time"
        },
        "location": {
            "displayName": "",
            "locationType": "default",
            "uniqueIdType": "unknown",
            "address": {},
            "coordinates": {}
        },
        "locations": [],
        "recurrence": null,
        "attendees": [],
    

    The following is the response for fetching this event using outlook.timezone="Australia/Sydney"

    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('36e3c7fc-1c36-41a0-9545-fe8480386523')/events/$entity",
        "@odata.etag": "W/\"IloTFbAhCkiHTVTwnI2TXQABdhI/3Q==\"",
        "id": "AQMkADI2ZDFmNDY4LTJlOWItNGVhOS1iM2E1LWZhMzg5ZDQ1MGUwNgBGAAADhQrIuhuED0_HAi76F3pFqAcAIloTFbAhCkiHTVTwnI2TXQAAAgENAAAAIloTFbAhCkiHTVTwnI2TXQABds_COQAAAA==",
        "createdDateTime": "2023-09-20T06:02:12.3726894Z",
        "lastModifiedDateTime": "2023-09-20T06:07:29.7537414Z",
        "changeKey": "IloTFbAhCkiHTVTwnI2TXQABdhI/3Q==",
        "categories": [],
        "transactionId": "ca0c9f61-e663-f79d-b93c-f172db6bde3d",
        "originalStartTimeZone": "Australia/Sydney",
        "originalEndTimeZone": "Australia/Sydney",
        "iCalUId": "040000008200E00074C5B7101A82E00800000000EF9B7EFF87EBD901000000000000000010000000C40FFE16D32F0C4E839D06014AEA7503",
        "reminderMinutesBeforeStart": 420,
        "isReminderOn": true,
        "hasAttachments": false,
        "subject": "all day busy",
        "bodyPreview": "",
        "importance": "normal",
        "sensitivity": "normal",
        "isAllDay": true,
        "isCancelled": false,
        "isOrganizer": true,
        "responseRequested": true,
        "seriesMasterId": null,
        "showAs": "busy",
        "type": "singleInstance",
        "webLink": "https://outlook.office365.com/owa/?itemid=AQMkADI2ZDFmNDY4LTJlOWItNGVhOS1iM2E1LWZhMzg5ZDQ1MGUwNgBGAAADhQrIuhuED0%2BHAi76F3pFqAcAIloTFbAhCkiHTVTwnI2TXQAAAgENAAAAIloTFbAhCkiHTVTwnI2TXQABds%2BCOQAAAA%3D%3D&exvsurl=1&path=/calendar/item",
        "onlineMeetingUrl": null,
        "isOnlineMeeting": false,
        "onlineMeetingProvider": "unknown",
        "allowNewTimeProposals": true,
        "occurrenceId": null,
        "isDraft": false,
        "hideAttendees": false,
        "responseStatus": {
            "response": "organizer",
            "time": "0001-01-01T00:00:00Z"
        },
        "body": {
            "contentType": "html",
            "content": ""
        },
        "start": {
            "dateTime": "2023-09-30T00:00:00.0000000",
            "timeZone": "Australia/Sydney"
        },
        "end": {
            "dateTime": "2023-10-01T00:00:00.0000000",
            "timeZone": "Australia/Sydney"
        },
        "location": {
            "displayName": "",
            "locationType": "default",
            "uniqueIdType": "unknown",
            "address": {},
            "coordinates": {}
        },
        "locations": [],
        "recurrence": null,
        "attendees": [],
        "organizer": {
            "emailAddress": {
                "name": "Wasif Samad",
                "address": "wasif.samad@lethub.co"
            }
        },
    

    Snapshot of the event from Outlook calendar:

    User's image

    1 person found this answer helpful.
    0 comments No comments

  2. CarlZhao-MSFT 41,286 Reputation points
    2023-09-20T09:11:37.05+00:00

    Hi @Wasif Samad

    You should specify the time zone for the event start and end times in the request headers, otherwise it will be returned in UTC by default.

    User's image

    GET https://graph.microsoft.com/v1.0/me/events/{event id} 
    
    Prefer: outlook.timezone="target time"
    

    Hope this helps.

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


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.