Skip to content

Instantly share code, notes, and snippets.

@ChrFrohn
Last active April 3, 2022 09:36
Show Gist options
  • Save ChrFrohn/32dc22173f82d848959951d967cb7c6c to your computer and use it in GitHub Desktop.
Save ChrFrohn/32dc22173f82d848959951d967cb7c6c to your computer and use it in GitHub Desktop.
Get Microsoft Teams meeting ID from JoinURL to be used in PowerShell with MSGraph
#This code below will provide with you with the ID of a Teams meeting using the Join URL - The Join URL can be found in a Teams Meeting invitation
#This can be used in Connection to Get-MgUserOnlineMeeting & Get-MgUserOnlineMeetingAttendanceReport
Connect-MgGraph #Choose a method (Dealers choice)
$UserId = "" #Can be found on the user object page in AzureAD (one of many ways)
JoinURL = "" #Right click "Join Teams Meeting" in the meeting invite and paste in here
$decodedUrl = [System.Web.HttpUtility]::UrlDecode($JoinUrl) #This to get rid of "%20" etc in the url
$TrimUrl = $decodedUrl.Substring(42, 69) #This removes parts of the URL that is not needed here
$CreateStringtoConvertToBase64 = "1*$UserID*0**$TrimUrl" #This combines the users ID and the part of the meeting URL we need
$CreateMeetingID = [System.Text.Encoding]::UTF8.GetBytes($CreateStringtoConvertToBase64) #Convers the combined string above to Base64
$MeetingID = [System.Convert]::ToBase64String($CreateMeetingID)
Get-MgUserOnlineMeeting -UserId $UserId -OnlineMeetingId $MeetingID | Select-Object Id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment