简体   繁体   中英

Microsoft Graph API: How to access guest calendar events using API?

I am working on the integration of the outlook calendar with our app. I am trying to get the calendar events of the guest user. So far I have done the following steps.

Registered an app in the Azure Active Directory admin centre and added the following API permissions.

API permissions

Then I used the following API call to get the access token.

https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token

I used this token to get the user list which is working fine.

https://graph.microsoft.com/v1.0/users

Then I am using user_id from this result to call the following APIs

https://graph.microsoft.com/v1.0/users/{user_id}/calendars
https://graph.microsoft.com/v1.0/users/{user_id}/calendars/events
https://graph.microsoft.com/v1.0/users/{user_id}/events

I am getting a successful result for Member users but getting the following error for guest users

>AuthOMMissingRequiredPermissions
>The AadGuestPft token doesn't contain the permissions required by the target API.

Any Idea what am I missing?

To get guest users(external) you can use https://graph.microsoft.com/v1.0/users?$filter=userType eq 'Guest' Graph API endpoint. This will give you all external users details in response. Event API will only work for the user within tenant, for external users who does not have license it will not work.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM