我正在尝试使用 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/