【问题标题】:Microsoft Graph API Create event always create meeting with UTC timezoneMicrosoft Graph API 创建事件始终使用 UTC 时区创建会议
【发布时间】:2020-06-05 14:07:40
【问题描述】:

我正在尝试使用 Graph API 创建一个会议,但它总是在 UTC 时区创建会议。

请求

POST https://graph.microsoft.com/v1.0/users/abc@xxx.onmicrosoft.com/calendar/events HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json
Authorization: Bearer xxxxxx
Prefer: outlook.timezone="Asia/Kolkata"
Content-Length: 1016
Host: graph.microsoft.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

{
  "subject": "Meeting SoapUI 4",
  "body": {
    "contentType": "HTML",
    "content": "Please Ignore !!! This invitation coming from SoapUI automation utility."
  },
  "start": {
    "dateTime": "2020-06-05T19:30:00.000Z",
    "timeZone": "Asia/Kolkata"
  },
  "end": {
    "dateTime": "2020-06-05T20:00:00.000Z",
    "timeZone": "Asia/Kolkata"
  }
}

回应

{
   "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('abc%40xxx.onmicrosoft.com')/calendar/events/$entity",
   "@odata.etag": "W/\"xxxx==\"",

   "originalStartTimeZone": "UTC",
   "originalEndTimeZone": "UTC",

   "subject": "MiniSync Meeting SoapUI 4",
   "bodyPreview": "Please Ignore !!! This invitation coming from SoapUI automation utility.",

   "responseStatus":    {
      "response": "organizer",
      "time": "0001-01-01T00:00:00Z"
   },
   "body":    {
      "contentType": "html",

   "start":    {
      "dateTime": "2020-06-05T19:30:00.0000000",
      "timeZone": "UTC"
   },
   "end":    {
      "dateTime": "2020-06-05T20:00:00.0000000",
      "timeZone": "UTC"
   }]
}

此外,尝试使用“印度标准时间”,但响应相同。添加了 Prefer 标头,但没有运气。 有人可以帮我解决我的错误吗?

【问题讨论】:

    标签: api graph outlook timezone microsoft-graph-api


    【解决方案1】:

    删除 dateTime 末尾的 Z 说明符。这指定了 UTC 并覆盖了您发送的时区。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多