Search code examples
javascriptoutlookmicrosoft-graph-api

Fetching events of room in Outlook calendar


I need to get events of rooms created in Outlook. I can fetch rooms with Graph API, then I'm using endpoint like this to get events of one specific room:

https://graph.microsoft.com/v1.0/users/zasadacka15@1t18wm.onmicrosoft.com/calendar/calendarView?$select=subject,start&StartDateTime=2023-01-01T00:00&EndDateTime=2023-01-01T00:00

I have all permissions I need, have events in calendar for this room created too, but every time (for every room) I get response like this:

{"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('zasadacka15%401t18wm.onmicrosoft.com')/calendar/calendarView(subject,start)", "value": []}

I read a lots of answers here and everywhere else, but I'm not able to solve this problem. (I'm using client_credentials flow.... Maybe I need to do impersonation, or does it have nothing to do with?)


Solution

  • So problem is solved. Problem was, that I did't created event for those rooms... I was thinking, that when I create event and as location select that room, it will append that event to that room. But nope, you need to create event AS room, to see room events. Thanks guyz for helping me, problem was banality, and this is little helper for those who will be dealing with something similar.