【发布时间】:2020-08-31 22:29:30
【问题描述】:
我正在尝试使用 Graph API 在我的个人日历(Office 365 帐户)中创建事件。我在 Azure 上的租户上创建了一个实例,具有以下委派权限:Calendars.Read、Calendars.ReadWrite、email、offline_access、openid、profile 和 User.Read。
oAuth2 登录按预期进行,我使用/.default 范围同时收到bearer_token 和refresh_token。但是当我尝试提出请求时:
POST /v1.0/me/calendar/events HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer eyJ0eXAi...
Content-Type: application/json
{
"subject": "Example",
"body": {
"contentType": "text",
"content": "Example description"
},
"start": {
"dateTime": "2020-09-01T12:00:00.000Z",
"timeZone": "America/Sao_Paulo"
},
"end": {
"dateTime": "2020-09-01T13:00:00.000Z",
"timeZone": "America/Sao_Paulo"
},
"location": {
"displayName": "Example location",
"locationUri": "https://example/uri"
}
}
我收到以下回复:
{
"error": {
"code": "ResourceNotFound",
"message": "Resource could not be discovered.",
"innerError": {
"date": "2020-08-31T22:18:15",
"request-id": "f03d0bdf-1a9c-41f4-a236-1c5a41a5d286"
}
}
}
我已经发现这是一个邮箱问题,因为使用Graph Explorer 我可以提出请求并更改我的日历,所以我愿意认为这是一个权限问题。
【问题讨论】: