List events of outlook calendar meeting room by a get request to display in a node app

Rakshya Panta 25 Reputation points
2023-02-24T12:15:29.37+00:00

I want to list all the meeting in the meeting room of outlook calendar through a get request in a node application. How is it possible? I tried Microsoft graph API but I cannot get any solutions.

I have registered an app in Azure AD and generated client secret ID also and set permissions as below:

Screenshot from 2023-02-23 12-35-15

Following this tutorial , I dynamically generated access tokens and I am able to list calendars of users, post events. But I cannot get event details of any calendars although permissions are of both Calendar read and write.

I am using https://graph.microsoft.com/v1.0/users/{userId}/events to get events but I cannot access it. It gives 403 error i.e permission error but as mentioned above I think I have enough permissions to read write. I can fetch calendars using /v1.0/users/{userId}/calendars and fetch users using /v1.0/users and post events using /v1.0/users/{userId}/calendars/{calendarId}/events by passing event payload.

But I cannot get events using /v1.0/users/{userId}/events and /v1.0/users/{userId}/calendarview?startDateTime=2023-02-25T13:00:00&endDateTime=2023-02-28T23:00:00.

I am getting the following error:

 error: {
      code: 'ErrorAccessDenied',
      message: 'Access is denied. Check credentials and try again.'
    }
Microsoft 365 and Office | Development | Office JavaScript API
Outlook | Windows | Classic Outlook for Windows | For business
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2023-02-24T13:43:10.3766667+00:00

    Hello @Rakshya Panta ,

    Thanks for reaching out.

    I am able to replicate your issue from my test tenant and I have resolved the issue with below approach:

    • Try to remove & revoke Calendars.ReadBasic.All permission from the specific app and grant the other required permissions again. 
    • After removing the above-mentioned permission, I am able to get all events of specific user.

    Please refer to similar post:
    https://learn.microsoft.com/en-us/answers/questions/1168465/get-event-using-microsoft-graph-erroraccessdenied

    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

2 additional answers

Sort by: Most helpful
  1. Rakshya Panta 25 Reputation points
    2023-02-27T06:29:43.1966667+00:00

    User's image

    After adding only these 2 permissions and removing and revoking all other unnecessary permissions I was able to retrieve calendar events

    0 comments No comments

  2. Rakshya Panta 25 Reputation points
    2023-02-27T06:52:46.44+00:00

    I removed and revoked all unnecessary permissions and added only two permissions:

    **User's image

    then i was able to retrieve calendar events**

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.