Search code examples
azureazure-ad-graph-api

Unable to Retrieve Online Meetings Data Using Microsoft Graph API


I'm currently working on an application that needs to retrieve all online meetings for a specific user using the Microsoft Graph API. Despite following the official documentation, I'm encountering an issue where the request returns no data.

Here's the endpoint I'm using:

GET https://graph.microsoft.com/v1.0/users/{userId}/onlineMeetings
{
    "error": {
        "code": "UnknownError",
        "message": "",
        "innerError": {
            "date": "2024-06-17T06:15:45",
            "request-id": "eef00a47-1aa0-418a-894f-6a79037000be",
            "client-request-id": "eef00a47-1aa0-418a-894f-6a79037000be"
        }
    }
}

Solution

  • Initially I registered one application and granted OnlineMeetings.ReadWrite.All permission of Application type that allows access to create meetings as well:

    enter image description here

    Make sure to create application access policy and grant access as below while using permissions of Application type by logging with Admin account:

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

    Response:

    enter image description here

    Now I generated access token using client credentials flow via Postman like this:

    POST https://login.microsoftonline.com/tenantId/oauth2/v2.0/token
    
    grant_type:client_credentials
    client_id: appId
    client_secret: secret
    scope: https://graph.microsoft.com/.default
    

    Response:

    enter image description here

    When I used this token to create online meetings with below API call, I got response like this:

    POST https://graph.microsoft.com/v1.0/users/userId/onlineMeetings
    {
      "startDateTime":"2024-06-18T14:30:34.2444915-07:00",
      "endDateTime":"2024-06-18T15:00:34.2464912-07:00",
      "subject":"Group Meeting"
    }
    

    Response:

    enter image description here

    To retrieve this online meeting data, you must either use meeting ID or filter with joinWebUrl for which the user is the organizer or attendee.

    Using Meeting ID:

    GET https://graph.microsoft.com/v1.0/users/userID/onlineMeetings/meetingID/
    

    Response:

    enter image description here

    Filtering with joinWebUrl:

    GET https://graph.microsoft.com/v1.0/users/userID/onlineMeetings?$filter=joinWebUrl eq 'https://teams.microsoft.com/l/meetup-join/xxxxxxxxxxxx'
    

    Response:

    enter image description here

    You cannot get all online meetings for a user at once as Graph API does not yet support List onlineMeetings method.

    References:

    Issue with MS Graph API to retrieve online meeting information - Microsoft Q&A by Carl Zhao - MSFT

    Get onlineMeeting - Microsoft Graph