Get Teams Webinars via Microsoft Graph

With virtualEventWebinar Microsoft Graph has a new API to list webinars. The API only includes read options for now. This option may help transfer webinar information to external systems.

The following permissions are worth noting for virtualEventWebinar:

  • An app registration is required to list webinars. The listing of all webinars only supports application permission.
  • With Delegated Permission, organizers could query their own webinars if the ID of the webinar is known (see example below).
  • An application access policy in Teams is required for application permissions. The policy authorizes an app to list webinars for selected accounts.

The requirements and processes from Microsoft Graph can be summarized:

  1. App registration is connected to a new Application Access Policy in Teams.
  2. Application Access Policy is assigned to selected user accounts.
  3. The Application Access Policy authorizes Graph to list webinars for the user accounts. For Microsoft Graph it counts which account is the organizer.

1) App registration for webinars

I created a new app registration with the VirtualEvent.Read.All permissions and uploaded my certificate for authentication in Entra ID. Only this permission is currently available for webinars.

Permission for the app registration
Permission for the app registration

2) Configure Application Access Policy in Teams

In the Graph documentation is a note about an Application Access Policy.

This API returns only webinars whose organizer has been assigned an application access policy.

The Application Access Policy instructions describe the process.
I created a new application access policy and connected the policy to the application ID of the app registration.

PowerShell
Import-Module MicrosoftTeams
Connect-MicrosoftTeams
$AppAccessPolicy = New-CsApplicationAccessPolicy -Identity "Webinar API Test" -AppIds "458636c5-d0b2-4efb-b9ac-371c18ad48ad"


I assigned the policy to an Entra ID group. Optionally, you can assign the policy to user accounts (User Assignment) or all employees (Global Assignment); see Grant-CsApplicationAccessPolicy.

PowerShell
Grant-CsApplicationAccessPolicy -PolicyName $AppAccessPolicy.Identity -Group "8667cfc4-6c88-4c11-8b98-e716d840de68"


Activation of the policy can take up to 30 minutes.


3) List webinars via Microsoft Graph

Once prepared, webinars should be available for authorized accounts via Graph.

PowerShell
Import-Module Microsoft.Graph.Authentication
Connect-MgGraph -ClientId "<AppID>" -CertificateThumbprint "<CertificateThumbprint>" -TenantId "<TenantID"

$Url = "https://graph.microsoft.com/beta/solutions/virtualEvents/webinars"
$AllWebinars = Invoke-MgGraphRequest -Method GET -Uri $Url -ContentType "application/json"  
$AllWebinars.value


I found 16 webinars for my account. The list includes various test webinars from the past.

PowerShell

Graph includes information about name, status, audience, date, and other properties of each webinar. The available properties are described in the documentation.

PowerShell

4) List webinar via ID

Microsoft describes listing a webinar using the Webinar ID in the documentation. The ID for a webinar is visible in Teams when the webinar is opened in Teams on the web and Manage Event is selected.

Manage webinar in Teams on the web
Manage webinar in Teams on the web

The address bar of your browser includes the ID 66412804-29c7-4570-b1de-5041a6ce30e0@ba304f99-a1c4-4b4c-827e-0d9f6063c05d. The ID can be used to query a single webinar.

PowerShell
Import-Module Microsoft.Graph.Authentication
Connect-MgGraph -ClientId "<AppID>" -CertificateThumbprint "<CertificateThumbprint>" -TenantId "<TenantID"

$Url = "https://graph.microsoft.com/beta/solutions/virtualEvents/webinars/66412804-29c7-4570-b1de-5041a6ce30e0@ba304f99-a1c4-4b4c-827e-0d9f6063c05d"
$Webinar = Invoke-MgGraphRequest -Method GET -Uri $Url -ContentType "application/json"  
$Webinar

PowerShell


5) Remove Application Access Policy from user account

The assignment of the Application Access Policy can be removed again. In my example, I remove the assignment from the group.

PowerShell
Grant-CsApplicationAccessPolicy -Group "8667cfc4-6c88-4c11-8b98-e716d840de68" -PolicyName $null


As a result, the query from Step 3 no longer includes webinars.

PowerShell
Share
Avatar photo

Tobias Asböck

Tobias is a Senior System Engineer with around ten years of professional experience with Microsoft 365 products such as SharePoint Online, OneDrive for Business, Teams Collaboration, Entra ID, Information Protection, Universal Print, and Microsoft 365 Licensing. He also has 15+ years of experience planning, administering, and operating SharePoint Server environments. Tobias is a PowerShell Scripter with certifications for Microsoft 365 products. In his spare time, Tobias is busy with updates in the Microsoft 365 world or on the road with his road bike and other sports activities. If you have additional questions, please contact me via LinkedIn or [email protected].

Leave a Reply

Your email address will not be published. Required fields are marked *