我想建立一个应用程序,将事件添加到组织用户的日历。
我有一个azure帐户,它也是一个office365帐户。
在本文的帮助下,我获得了一个访问令牌:https://learn.microsoft.com/en-us/graph/auth-v2-service这些是我用来获取令牌的参数和结束点:https://login.microsoftonline.com/{my_tenant_id}/oauth2/版本/标记
grant_type - client_credentials
client_secret -{生成的客户端秘密}
client_id -{应用客户端id}
scope - https://graph.microsoft.com/.default
我在这个端点上累了:https://graph.microsoft.com/v1.0/users/{my_user_object_id}看起来令牌工作正常。
但是当我尝试添加一个事件与这个端点:https://graph.microsoft.com/v1.0/users/{my_user_object_id}/events我得到这个错误:
"error": {
"code": "ResourceNotFound",
"message": "Resource could not be discovered.",
"innerError": {
"date": "2022-07-14T12:50:53",
"request-id": "382c2807-2aa6-4b54-b686-55051f809e3b",
"client-request-id": "382c2807-2aa6-4b54-b686-55051f809e3b"
}
}
我给了这个前提并授予它们:
日历。阅读应用
日历。读写应用
用户。读委托
User.Read。所有的应用程序>
/ul>知道我该怎么做吗?
POST /users/{id | userPrincipalName}/events
不是向用户日历添加事件的有效端点。
您必须使用POST /users/{id | userPrincipalName}/calendar/events
作为默认日历。
或指定日历:/users/{id | userPrincipalName}/calendars/{id}/events
.
。