azuremicrosoft-graph-apimicrosoft-teams

How to retrieve attendance reports from Teams Meetings using Application Permissions


I’m new to working with the Microsoft Graph API and Azure. I want to retrieve the attendance reports for all Teams meetings in my organization, but I’m struggling to understand how to do this using application permissions (app-only authentication).

From what I’ve seen, most examples and documentation talk about delegated permissions, where a user is signed in, but I want to automate this process for my entire tenant.

Is it even possible to get attendance reports with application permissions? If yes, what API permissions do I need to set up in Azure? Which Microsoft Graph API endpoints or approach should I use?

I’d appreciate any help or examples because I’m still learning how all of this works.


Solution

  • To retrieve the attendance reports for all Teams meetings in my organization, using application permissions.

    Registered Single-Tenant Microsoft Entra ID Application, To retrieve the Meeting Attendance Report, Added OnlineMeetingArtifact.Read.All Application type API permission and Granted Admin Consent like below:

    enter image description here

    Refer this MsDoc , Ensure to create and configure application access policy and grant access as below while using permissions of Application type by logging with Admin account using Powershell:

    Install-Module -Name MicrosoftTeams -Force -AllowClobber
    
    Import-Module MicrosoftTeams
    Connect-MicrosoftTeams
    
    New-CsApplicationAccessPolicy -Identity Demo-policy -AppIds "<app-id>" -Description "Allow access to Teams App"
    
    Grant-CsApplicationAccessPolicy -PolicyName Demo-policy -Global
    

    enter image description here

    After creating Application Access Policy, For accessing Application-type API permission need to use client-credentials flow Generated access token using below parameter:

    GET https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/token
    
    client_id = <client_id>
    client_secret= <client secret>
    grant_type = client_credentials
    scope = https://graph.microsoft.com/.default
    
    

    enter image description here

    Use the same access token, To retrieve the online meeting data which you want to check the attendee Report, you must need to have either meeting ID or filter with joinWebUrl for which the user is the organizer or attendee.

    GET https://graph.microsoft.com/v1.0/users/<user-id>/onlineMeetings?$filter=joinUrl eq https://teams.microsoft.com/l/meetup-join/.....
    

    or

    GET https://graph.microsoft.com/v1.0/users/<user-id>/onlineMeetings/<meeting-id>/
    

    enter image description here

    To retrieve the list of meetingAttendanceReport by using same access token, use below query:

    GET https://graph.microsoft.com/v1.0/users/<user-id>/onlineMeetings/<online-meetingId>/attendanceReports
    

    enter image description here

    References:

    API permission for Retrieve Meeting Attendance Report

    API permission for Retrieve Online Meeting - Application type