api - Microsoft Graph API 创建事件始终使用 UTC 时区创建 session

标签 api graph outlook timezone microsoft-graph-api

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

请求

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 标题但没有运气。 有人可以帮助我犯错吗?

最佳答案

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

关于api - Microsoft Graph API 创建事件始终使用 UTC 时区创建 session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62217247/

相关文章:

ajax - Spotify 应用程序请求授权

java - 使用 Stream api 打印 HashMap 值

algorithm - 如果添加边更新最小生成树

algorithm - 有两个条件的最短路径问题

vba - 从 Outlook 打开时的 Excel 安全设置

java - 如何使用java程序知道数据库是否更新

c - 嵌入式系统的图形API

algorithm - 不使用 DFS 判断一个图是否有环

Outlook 加载项自动更新

html - 如何在显示 : none? 后使用类来显示特定元素