使用Microsoft-Graph安排会议时的时区问题

时间:2019-04-01 09:25:13

标签: microsoft-graph microsoft-graph-calendar

当我使用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

1 个答案:

答案 0 :(得分:1)

当您在时间结尾处放置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"
  }
}