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

Sanket Khot 51 Reputation points
2023-01-13T04:59:39.75+00:00

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.

User's image

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 ?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,511 questions
0 comments No comments
{count} votes

Accepted answer
  1. Gopinath Chennamadhavuni 2,426 Reputation points
    2023-01-13T06:15:26.9233333+00:00

    Hi @Sanket Khot ,

    Hope you are doing well.

    As per my knowledge, we cannot get event details of external/guest user, or any user that does not actually have an Exchange Online mailbox (within your own tenant). The only way around this would be to have AAD app and the external user (or an admin from his organization) consent to your app, thus add it to their own tenant and grant the relevant permissions. A mailbox will still be required.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments

0 additional answers

Sort by: Most helpful