Node.js Outlook API日历中的时差
我对Outlook API的使用有问题,特别是日历API 我使用UTC格式发送日期,当它们添加到日历中时,我与发送日期有差异 我在法国,所以原始日期是UTC+2。我使用UTC转换并使用以下配置发出请求:Node.js Outlook API日历中的时差,node.js,microsoft-graph-api,outlook-restapi,Node.js,Microsoft Graph Api,Outlook Restapi,我对Outlook API的使用有问题,特别是日历API 我使用UTC格式发送日期,当它们添加到日历中时,我与发送日期有差异 我在法国,所以原始日期是UTC+2。我使用UTC转换并使用以下配置发出请求: var options = { url: "https://outlook.office.com/api/v2.0/me/calendars/" + workspace.calendarId + "/events?$Select=Id", meth
var options = {
url: "https://outlook.office.com/api/v2.0/me/calendars/" + workspace.calendarId + "/events?$Select=Id",
method: "POST",
headers: {
"authorization": "Bearer " + host.outlookCalAccessToken,
"accept" : "application/json",
"ContentType" : "application/json"
},
json:{
"Subject" : event.summary,
"Body" : {
"ContentType" : "Text",
"Content" : event.description
},
"Start" : {
"DateTime":start,
"TimeZone" : "OriginStartTimeZone"
},
"End" : {
"DateTime":end,
"TimeZone" : "OriginStartTimeZone"
},
"Attendees" : [
{
"EmailAddress" : {
"Name" : nomad.firstname,
"Address" : nomad.email
},
"Type" : "Required"
}
]
},
"Content-Type" : "application/json"
};
如果时区是“OriginStartTimeZone”或“UTC”,我也会遇到同样的问题
例如,我的本地日期是2017-10-19T17:00:00.000
它被转换为UTC2017-10-19T15:00:00.000Z
在日历中,活动日期为2017-10-19T08:00:00.000
这个API遗漏了什么
谢谢 如果希望活动开始日期为2017-10-19当地时间10:30,则开始对象应如下所示:
Start:{DateTime: "2017-10-19T10:30:00+02:00", TimeZone: "UTC"}
这就是你的开始对象的样子吗?如果是,则事件时间应在日历中正确显示。如果希望事件开始日期为2017-10-19当地时间10:30,则开始对象应如下所示:
Start:{DateTime: "2017-10-19T10:30:00+02:00", TimeZone: "UTC"}
这就是你的开始对象的样子吗?如果是,则事件时间应在日历中正确显示。
OriginStartTimeZone
不是时区的有效值。如果将时区
设置为UTC
,则应获得预期结果。我刚刚用这个有效载荷测试了它:
{
"Subject" : "test",
"Body" : {
"ContentType" : "Text",
"Content" : "hello"
},
"Start" : {
"DateTime": "2017-10-19T15:00:00.000Z",
"TimeZone" : "UTC"
},
"End" : {
"DateTime": "2017-10-19T16:00:00.000Z",
"TimeZone" : "UTC"
}
}
在回复我的帖子和随后的事件GET请求时,我得到了以下回复:
"Start": {
"DateTime": "2017-10-19T15:00:00.0000000",
"TimeZone": "UTC"
},
"End": {
"DateTime": "2017-10-19T16:00:00.0000000",
"TimeZone": "UTC"
},
OriginStartTimeZone
不是时区的有效值。如果将时区
设置为UTC
,则应获得预期结果。我刚刚用这个有效载荷测试了它:
{
"Subject" : "test",
"Body" : {
"ContentType" : "Text",
"Content" : "hello"
},
"Start" : {
"DateTime": "2017-10-19T15:00:00.000Z",
"TimeZone" : "UTC"
},
"End" : {
"DateTime": "2017-10-19T16:00:00.000Z",
"TimeZone" : "UTC"
}
}
在回复我的帖子和随后的事件GET请求时,我得到了以下回复:
"Start": {
"DateTime": "2017-10-19T15:00:00.0000000",
"TimeZone": "UTC"
},
"End": {
"DateTime": "2017-10-19T16:00:00.0000000",
"TimeZone": "UTC"
},
将时区更改为UTC后,问题仍然存在。我发现了它不起作用的地方。在网络邮件中,时区设置为UTC-8,尽管我在注册时填写了正确的时区。。。
谢谢你的回答 将时区更改为UTC后,问题仍然存在。我发现了它不起作用的地方。在网络邮件中,时区设置为UTC-8,尽管我在注册时填写了正确的时区。。。
谢谢你的回答