Microsoft Graph API 创建重复事件 returns 500
Microsoft Graph API creating recurring event returns 500
我正在编写一个使用 Microsoft Graph API v1.0 与 Office365 事件同步的应用程序。
创建单个事件时,事件按预期创建:
Response Status Code: 201 Created
Request URL: https://graph.microsoft.com/v1.0/me/calendars/<myCalendarId>/events
Request Method: POST
Request Payload:
{
"subject": "single event",
"start": {
"dateTime": "2020-02-15T09:00:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-02-15T10:00:00",
"timeZone": "Europe/Berlin"
},
"attendees": [],
"type": "singleInstance",
"location": {
"displayName": null
},
"recurrence": null
}
但是,如果我为重复发生的事件发送创建请求,我会收到错误响应。
Response Status Code: 500 Internal Server Error
Request URL: https://graph.microsoft.com/v1.0/me/calendars/<myCalendarId>/events
Request Method: POST
Request Payload:
{
"subject": "test recurring event",
"start": {
"dateTime": "2020-02-14T09:00:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-02-14T10:00:00",
"timeZone": "Europe/Berlin"
},
"attendees": [],
"location": {
"displayName": null
},
"recurrence": {
"pattern": {
"daysOfWeek": [],
"type": "daily"
},
"range": {
"numberOfOccurrences": "2",
"recurrenceTimeZone": "Europe/Berlin",
"startDate": "2020-02-14",
"type": "numbered"
}
}
}
Response Body:
{
"error": {
"code": "ErrorInternalServerError",
"message": "An internal server error occurred. The operation failed.",
"innerError": {
"request-id": "2d97931c-e08c-45a8-8167-5849df53a694",
"date": "2020-02-14T14:38:28"
}
}
}
我觉得奇怪的是,添加重复设置会导致 Internal Server Error
。
如何使用 API 创建重复事件?
如果您想创建每天发生的重复事件,而不是按以下方式设置模式:
"pattern": {
"daysOfWeek": [],
"type": "daily"
},
请这样设置模式:
"pattern": {
"type": "daily",
"interval": 1
},
参考文档中描述了创建每日重复模式here in the conceptual docs. Within the next day, there will also be a REST example。
我正在编写一个使用 Microsoft Graph API v1.0 与 Office365 事件同步的应用程序。
创建单个事件时,事件按预期创建:
Response Status Code: 201 Created
Request URL: https://graph.microsoft.com/v1.0/me/calendars/<myCalendarId>/events
Request Method: POST
Request Payload:
{
"subject": "single event",
"start": {
"dateTime": "2020-02-15T09:00:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-02-15T10:00:00",
"timeZone": "Europe/Berlin"
},
"attendees": [],
"type": "singleInstance",
"location": {
"displayName": null
},
"recurrence": null
}
但是,如果我为重复发生的事件发送创建请求,我会收到错误响应。
Response Status Code: 500 Internal Server Error
Request URL: https://graph.microsoft.com/v1.0/me/calendars/<myCalendarId>/events
Request Method: POST
Request Payload:
{
"subject": "test recurring event",
"start": {
"dateTime": "2020-02-14T09:00:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-02-14T10:00:00",
"timeZone": "Europe/Berlin"
},
"attendees": [],
"location": {
"displayName": null
},
"recurrence": {
"pattern": {
"daysOfWeek": [],
"type": "daily"
},
"range": {
"numberOfOccurrences": "2",
"recurrenceTimeZone": "Europe/Berlin",
"startDate": "2020-02-14",
"type": "numbered"
}
}
}
Response Body:
{
"error": {
"code": "ErrorInternalServerError",
"message": "An internal server error occurred. The operation failed.",
"innerError": {
"request-id": "2d97931c-e08c-45a8-8167-5849df53a694",
"date": "2020-02-14T14:38:28"
}
}
}
我觉得奇怪的是,添加重复设置会导致 Internal Server Error
。
如何使用 API 创建重复事件?
如果您想创建每天发生的重复事件,而不是按以下方式设置模式:
"pattern": {
"daysOfWeek": [],
"type": "daily"
},
请这样设置模式:
"pattern": {
"type": "daily",
"interval": 1
},
参考文档中描述了创建每日重复模式here in the conceptual docs. Within the next day, there will also be a REST example。