Microsoft Graph API 创建事件始终使用 UTC 时区创建会议

rAJ*_*rAJ 4 api outlook timezone graph microsoft-graph-api

我正在尝试使用 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"
  }
}
Run Code Online (Sandbox Code Playgroud)

回复

{
   "@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"
   }]
}
Run Code Online (Sandbox Code Playgroud)

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

Jas*_*ton 9

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