Why access denied response is coming when we hit the Get Event API request even though user_id as an admin access?

Sree S V 5 Reputation points
2023-01-24T10:55:15.82+00:00

We got the error access denied error when we tried to hit the Get Event request in Microsoft graph API

API URL: https://graph.microsoft.com/v1.0/users/{user_id}/events
Response:

{
    "error": {
        "code": "ErrorAccessDenied",
        "message": "Access is denied. Check credentials and try again."
    }
}
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,476 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. HarmeetSingh7172 4,811 Reputation points
    2023-01-24T11:12:33.0566667+00:00

    Hello @Sree S V

    Thanks for reaching out!

    It seems that you are using delegated permissions to access users/{user-id}/events endpoint. For accessing this API, you require an application token. Refer this document to know more about it. Please make sure that your app has been granted the Calendars.Read application permission to list/read the events of a particular user. Alternatively, you can test the users/{user-id}/events API in Postman with Calendars.Read application permission granted to your Azure App.

    Please refer this access scenarios document for more details.

    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.