Kristian
Kristian

Reputation: 15

Timezone issues when scheduling a meeting using microsoft-graph

When I schedule a new meeting using Microsoft Graph Explorer, I get the wrong time.

If I call https://graph.microsoft.com/v1.0/me/mailboxsettings, I get my Time Zone: "timeZone": "W. Europe Standard Time".

If I then call https://graph.microsoft.com/v1.0/me/events with the payload:

{
  "subject": "My event W. Europe Standard Time 3",
  "start": {
    "dateTime": "2019-04-02T16:01:03.353Z",
    "timeZone": "W. Europe Standard Time"
  },
  "end": {
    "dateTime": "2019-04-02T16:47:03.353Z",
    "timeZone": "W. Europe Standard Time"
  }
}

I get the scheduled meeting in my Outlook as expected, but the time is incorrect. The time I get in Outlook is 18:10 to 18:47.

Upvotes: 0

Views: 679

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33094

When you put a Z at the end of the time, you're saying the time is UTC. You need to remove the time zone information from the time in order for it to get treated as a local time:

{
  "subject": "My event W. Europe Standard Time 3",
  "start": {
    "dateTime": "2019-04-02T16:01:00",
    "timeZone": "W. Europe Standard Time"
  },
  "end": {
    "dateTime": "2019-04-02T16:47:00",
    "timeZone": "W. Europe Standard Time"
  }
}

Upvotes: 1

Related Questions