使用 microsoft-graph 安排会议时出现时区问题

Timezone issues when scheduling a meeting using microsoft-graph

当我使用 Microsoft Graph Explorer 安排新会议时,我得到了错误的时间。

如果我调用 https://graph.microsoft.com/v1.0/me/mailboxsettings,我会得到我的时区:"timeZone": "W. Europe Standard Time"

如果我随后使用负载调用 https://graph.microsoft.com/v1.0/me/events

{
  "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"
  }
}

我在 Outlook 中按预期收到预定的会议,但时间不正确。我进入 Outlook 的时间是 18:1018:47

当您在时间末尾添加 Z 时,您表示时间 UTC。您需要从时间中删除时区信息,以便将其视为当地时间:

{
  "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"
  }
}