Context
The use case of my application:
- User should be able to link Microsoft 365 organization to the app.
- User should be able to see all rooms in the organization. Currently, I use "List places" API: GET /places/microsoft.graph.room
- User should be able to see how the room is used historically, some kind of occupancy analytics.
The current plan is:
- Make an initial fetch of the last N-months of events for a room using the "List events" API and persist those in the DB. GET /users/room1@someorg.onmicrosoft.com/events
- Subscribe to the new events via Event Hub to catch newly created events.
- Build some analytics based on the stored events.
Problem
I cannot fetch events for a room because of permission issues.
GET /users/room1@someorg.onmicrosoft.com/events
returns 403 error with payload
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again."
}
}
Prerequisites:
- My user is a full admin of the organization
- All necessary permissions are acquired while creating an access token: Calendars.ReadBasic, Calendars.Read, Calendars.ReadWrite
The solution I found:
Add myself to the Delegates list of the room I want to get events from. It could be managed in the Edit room view of the Microsoft 365 admin center.
Unfoturenetly, this doesn't look like a working solution for production, as I would need to ask our end users to make that setting change in their admin center. And also it looks like Delegates setting is designed for other reasons.
Question
How to get the calendar events for a room avoiding the permission issues I described? The solution should also take into account the intention to receive the events updates using the Event Hub subscriptions.