I was given a task to help setting up an integration between a WordPress site and Exchange Online. In WordPress, the client wanted to show a Meeting Room Calendar. To link the Calendar you need an "ID" value. This value can be found by using Microsoft Graph.
MS Graph is located here: https://developer.microsoft.com/en-us/graph/graph-explorer
After you log in with your licenced M365 account, that have an Exchange Mailbox, you can easily find the correct ID-value to use for the integration:
But we are not going to integrate with my personal Calendar, so how can we find the Meeting Room Calendar ID?
First we have to use a bit of PowerShell magic, we know the mail address of the meeting room, so we request information from EXO and we must filter the output. The value we are looking for is named "ExternalDirectoryObjectID".
Then we use the value of "ExternalDirectoryObjectId" when searching in MS Graph. We also have to change a part in the query from "../me/calendars/ to "../users/xxx-xxxx/calendars/"
And just like that we got the right kind of ID that we can use in our WordPress integration.
If you need to create a list of all the Room Mailbox ExternalDirectoryObjectId, you can create a CSV with one simple line in PowerShell:
Get-Mailbox -RecipientTypeDetails RoomMailbox | Select-Object DisplayName, ExternalDirectoryObjectId | export-csv "c:\temp\RoomMailbox_ExternalDirectoryObjectId_list.csv" -Encoding UTF8
You can replace ExternalDirectoryObjectId with UserPrincipalName
This was perfect for what I needed thank you!