How can I find the ID of all meeting room calendars?

212 views Asked by At

Environment: Exchange Online and Wordpress

Issue: we are trying to connect and show Meeting Room Calendars to Worpress.

If I go to MS Graph, I can run a simple command to find a ID for my personal calendar. The command is: https://graph.microsoft.com/v1.0/me/calendars

It will return lots of values, the one we need is "id" that is very long, and not a GUID.

The ID value I need, looks like this:

"id": "AAMkADcxMzk2N2Y3LWFjMTktNGY1OS1hYLYwLTI3NzlkZDhMDAwZgBGAAAAAAAPB-v1RThsTKqjr5R_SEg0BwB83cbkVfyiT6pN-8Cf8VcaAAGGAAEGAB84cbkVfyiT6pN-8Cf8VcaAAAARYCdAAA="

I can then use this ID in Wordpress to show the calendar through a integration.

But I need to show the calendar for our Meeting rooms, I have been playing around in Graph with different values, but I cannot find the same "id" for the meeting room calendar.

Closest I get is using this command: https://graph.microsoft.com/v1.0/users/c2c19414-c314-2d8f-be76f-9855727a209e/calendar

But I get error Not found 404 and a message: The specified object was not found in the store.

Any suggestions to how I can find the meeting room calendar ID?

2

There are 2 answers

0
Bjerved On BEST ANSWER

I found the answer, and all I neeeded was to first find a value on the Room Mailbox Calendar that is named: "ExternalDirectoryObjectID". Then I took the value from this ID and used in the search string in MS Graph.

I have written a short guide to how I did it her: https://www.blueclouds.no/post/how-to-find-the-right-id-for-a-room-mailbox-calendar

0
user2250152 On

The error 404 with the message The specified object was not found in the store is usually due to tenant policy which blocks access to some mailbox folders.

I'm using PowerShell ExchangeOnlineManagement module to add mailbox folder permission

Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser
Import-Module ExchangeOnlineManagement
$secpasswd = ConvertTo-SecureString '<password>' -AsPlainText -Force
$user = "[email protected]"

$o365cred = New-Object System.Management.Automation.PSCredential ($user, $secpasswd)

Connect-ExchangeOnline -Credential $o365cred

Add-MailboxFolderPermission -Identity {room_email}:\Calendar -User "{user_upn}" -AccessRights ReadItems

Disconnect-ExchangeOnline -Confirm:$false
  • The Identity parameter specifies the target mailbox and folder. The syntax is MailboxID:\ParentFolder[\SubFolder].
  • The User parameter specifies who's granted permission to the mailbox folder.
  • The AccessRights parameter specifies the permissions that you want to add for the user on the mailbox folder. ReadItems: The user can read items within the specified folder.

Now, the user should be able to access only events and calendar of the meeting room.

GET https://graph.microsoft.com/v1.0/users/{room_id}/calendar
GET https://graph.microsoft.com/v1.0/users/{room_id}/calendarView
GET https://graph.microsoft.com/v1.0/users/{room_id}/events