我已经在azure门户中为组织注册了一个应用程序。使用图谱api,我可以通过使用https://graph.microsoft.com/v1.0/users
来使用图谱api访问租户中存在的所有用户。但是获取用户的日历时,会发生错误。
also we have get all permission
https://i.stack.imgur.com/JZY5b.png
This is the process that I am using to get an individual user's calendar:
1. get user's access token [Get access without a user] https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token
2. get the users list by api `https://graph.microsoft.com/v1.0/users` with access_token
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"value": [{
"businessPhones": [],
"displayName": "XXX",
"givenName": "XXXX",
"userPrincipalName": "xxxxxxx@chinbaico.onmicrosoft.com",
"id": "d20ccb69-a7f3-4cd1-acb8-eecac819e01a"
}, {
"businessPhones": [],
"displayName": "XXX",
"givenName": "XXXX",
"userPrincipalName": "XXXXXX@chinbaico.onmicrosoft.com",
"id": "68d9f739-8eb9-416b-9f3c-b1d07b17b099"
}]
}
3. select one and copy `id/userPrincipalName` from the user list
4.call and get calendar event `https://graph.microsoft.com/v1.0/users/id/calendars/events`.
In this process I am getting Resource could not be discovered.
{
"error": {
"code": "ResourceNotFound",
"message": "Resource could not be discovered.",
"innerError": {
"request-id": "aee46b86-25e7-4b1a-98c9-c0692304111e",
"date": "2020-04-18T08:28:23"
}
}
}
Please let me know if my approach is correct or not.