How to fetch Meeting ID from given Meeting ID and Password in the Teams Meeting Calendar via coding?

Kripa 140 Reputation points
2024-11-05T08:57:49.5933333+00:00

Ref Link:https://learn.microsoft.com/en-us/microsoftteams/platform/graph-api/meeting-transcripts/fetch-id

When i m trying to fetch Meeting ID using Graph Explorer ,it giving all the necessary details and i m using my Tenant ID.

GET https://graph.microsoft.com/v1.0/me/onlineMeetings?$filter=joinMeetingIdSettings/joinMeetingId%20eq%20'1234567890'

But when same thing i m doing with code using python with Tenant ID.I am facing error:

My code is:

from msgraph import GraphServiceClient
from msgraph.generated.users.item.online_meetings.online_meetings_request_builder import OnlineMeetingsRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from azure.identity import ClientSecretCredential
tenant_id = "bnbn"
client_id = "vbvbv"
client_secret = "bnbnv"
SCOPES = ['https://graph.microsoft.com/.default'] 
credential = ClientSecretCredential(tenant_id=tenant_id, client_id=client_id, client_secret=client_secret)

graph_client = GraphServiceClient(credential, scopes=SCOPES)

# Define query parameters to filter meetings by the joinMeetingId
query_params = OnlineMeetingsRequestBuilder.OnlineMeetingsRequestBuilderGetQueryParameters(
    filter="joinMeetingIdSettings/joinMeetingId eq '1234567895'"
)

# Configure the request with query parameters
request_configuration = RequestConfiguration(
    query_parameters=query_params,
)

# Asynchronously fetch the online meeting details
async def get_meeting():
    try:
        result = await graph_client.me.online_meetings.get(request_configuration=request_configuration)
        # Process and display result (e.g., print details or extract specific fields)
        print(result)  # Modify as needed to handle `result` data
    except Exception as e:
        print("Error fetching meeting:", e)

# Run the async function
import asyncio
asyncio.run(get_meeting())

Error:

User's image

message='/me request is only valid with delegated authentication flow.'

Please assist me ASAP!!!

Microsoft Teams | Development
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Sayali-MSFT 3,996 Reputation points Microsoft External Staff Moderator
    2024-11-11T09:25:11.82+00:00

    Hello Kripa, It looks like you're encountering an issue with the UsersRequestBuilder object in your Python code. The error message 'UsersRequestBuilder' object is not callable suggests that there might be a problem with how the request is being constructed or executed.

    To resolve this issue, you can use the correct method to fetch the online meeting details. Here's an updated version of your code:

    from msgraph import GraphServiceClient
    from msgraph.generated.users.item.online_meetings.online_meetings_request_builder import OnlineMeetingsRequestBuilder
    from kiota_abstractions.base_request_configuration import RequestConfiguration
    from azure.identity import ClientSecretCredential
    
    tenant_id = "jkjjk"
    client_id = "nmnm"
    client_secret = "hkjj"
    User_id = "jkkj"
    SCOPES = ['https://graph.microsoft.com/.default'] 
    credential = ClientSecretCredential(tenant_id=tenant_id, client_id=client_id, client_secret=client_secret)
    
    graph_client = GraphServiceClient(credential, scopes=SCOPES)
    
    # Define query parameters to filter meetings by the joinMeetingId
    query_params = OnlineMeetingsRequestBuilder.OnlineMeetingsRequestBuilderGetQueryParameters(
        filter="joinMeetingIdSettings/joinMeetingId eq '41234578912'"
    )
    
    # Configure the request with query parameters
    request_configuration = RequestConfiguration(
        query_parameters=query_params,
    )
    
    # Asynchronously fetch the online meeting details
    async def get_meeting():
        try:
            # Correct method to fetch online meeting details
            result = await graph_client.users[User_id].online_meetings.get(request_configuration=request_configuration)
            # Process and display result (e.g., print details or extract specific fields)
            print(result)  # Modify as needed to handle `result` data
        except Exception as e:
            print("Error fetching meeting:", e)
    
    # Run the async function
    import asyncio
    asyncio.run(get_meeting())
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Hitesh Pachipulusu - MSFT 3,620 Reputation points Microsoft External Staff
    2024-11-05T09:20:36.83+00:00

    Hello Kripa,

    Thank you for contacting Microsoft Support!

    It looks like you're encountering an issue because the /me endpoint requires delegated authentication, which is typically used in scenarios where a user is signed in and their permissions are being used. However, your code is using application permissions (client credentials flow), which is not compatible with the /me endpoint.

    To resolve this, you can use the /users/{user-id} endpoint instead of /me.

    Make sure to replace 'user-id' with the actual user ID of the user whose meetings you want to fetch. This should resolve the issue with the authentication flow.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.