【问题标题】:Unable to add calendar event with old date via Office 365 REST API无法通过 Office 365 REST API 添加具有旧日期的日历事件
【发布时间】:2016-05-25 22:52:06
【问题描述】:

Office 365 REST API 中似乎存在某种限制,阻止添加日期较早的事件,但我无法确定具体限制。例如,以下 JSON 负载会导致请求失败并返回 400 响应:

{
    "Subject":"Task/Other",
    "Location":{},
    "Body": {
        "ContentType":"Text",
        "Content":"Appointment text"
    },
    "Start": {
        "DateTime":"1983-05-12T19:00:00",
        "TimeZone":"America/New_York"
    },
    "End": {
        "DateTime":"1983-05-12T19:30:00",
        "TimeZone":"America/New_York"
    }
}

但是,以下负载成功:

{
    "Subject":"Task/Other",
    "Location":{},
    "Body": {
        "ContentType":"Text",
        "Content":"Appointment text"
    },
    "Start": {
        "DateTime":"2016-05-12T19:00:00",
        "TimeZone":"America/New_York"
    },
    "End": {
        "DateTime":"2016-05-12T19:30:00",
        "TimeZone":"America/New_York"
    }
}

唯一的区别是最近的活动日期。我无法在 API 文档中找到有关任何此类约束的任何内容。我错过了什么?

【问题讨论】:

标签: office365 office365api office365-restapi


【解决方案1】:

我可以重现这个问题。但是,在我将时区更改为 UTC 后,问题就解决了。作为一种解决方法,我建议您先将时间从“America/New_York”转换为“UTC”,然后使用 UTC 时间。

这是我测试的样本供您参考:

POST: https://graph.microsoft.com/v1.0/me/events/
authorization: bearer {token}
Content-type: application/json
{
"Subject":"Task/Other",
"Location":{'DisplayName':'Water Cooler'},
"Body": {
    "ContentType":"Text",
    "Content":"Appointment text"
},
"Start": {
    "DateTime":"1983-05-12T19:00:00",
    "TimeZone":"UTC"
},
"End": {
    "DateTime":"1983-05-12T19:30:00",
    "TimeZone":"UTC"
}
}

要解决此问题,您可以尝试通过here 联系 Office 开发团队。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-28
    相关资源
    最近更新 更多