【发布时间】:2021-01-07 14:47:31
【问题描述】:
我正在尝试使用 Microsoft Graph API 创建带有扩展数据的日历事件。(实际上,我正在尝试将现有的开放扩展转换为架构扩展,因为我无法过滤开放扩展的非 id 扩展值.)
在我尝试之前,我已经成功创建了my schema extension,并创建了一个带有架构扩展响应错误代码“BadRequest”和消息“请求必须仅包含扩展更改”的日历事件。
我尝试通过关注doc 来做到这一点。
POST https://graph.microsoft.com/v1.0/me/calendars/{calendar-group-id}/events
{
"subject": "schema extension test",
"body": {
"contentType": "HTML",
"content": "schema extension test"
},
"start": {
"dateTime": "2021-01-22T12:00:00",
"timeZone": "Eastern Standard Time"
},
"end": {
"dateTime": "2021-01-23T14:00:00",
"timeZone": "Eastern Standard Time"
},
"attendees": [],
"extendedData": {
"courseId": "11",
"materialId": "22",
"courseType": "video"
}
}
response:
{
"error": {
"code": "BadRequest",
"message": "Requests must contain extension changes exclusively.",
"innerError": {
...
}
}
}
没有extendedData,创建事件响应成功,创建事件后,如果我patch事件只有extendedData,它响应错误“名为'Microsoft.OutlookServices.OpenTypeExtension'的类型不能由模型解析。当模型可用时,每个类型名称都必须解析为有效类型。
PATCH https://graph.microsoft.com/v1.0/me/calendars/{calendar-group-id}/events/{event-id}
{
"extendedData": {
"courseId": "11",
"materialId": "22",
"courseType": "video"
}
}
response:
{
"error": {
"code": "RequestBodyRead",
"message": "A type named 'Microsoft.OutlookServices.OpenTypeExtension' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.",
"innerError": {
...
}
}
}
当我通过同意Calendars.Read 权限登录用户使用 Graph API 浏览器时,我能够成功。
但如果我在邮递员中尝试同样的事情,它就行不通了。
【问题讨论】:
标签: azure-active-directory microsoft-graph-api microsoft-graph-calendar