Как получить календарь пользователей в Microsoft Graph API - PullRequest
1 голос
/ 18 апреля 2020

Я зарегистрировал приложение на портале azure для организации. С графиком API я могу получить доступ ко всем пользователям, присутствующим в арендаторе, используя график API, используя https://graph.microsoft.com/v1.0/users. Но при получении календаря пользователя возникает ошибка.

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. 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...