1
votes

I am trying to create a MS Teams meeting using MS Graph API. It's documented that in order to create meeting, Delegated "OnlineMeetings.ReadWrite" permission should be assigned to Azure application. enter image description here

I assigned this permission but I get response:

{'error': {'code': 'Forbidden', 'message': '', 'innerError': {'request-id': 'baa2940f-6b8e-45c1-8ea1-770792266458', 'date': '2021-01-15T10:00:14', 'client-request-id': 'baa2940f-6b8e-45c1-8ea1-770792266458'}}}

Here is my code:

    meeting = {
        "startDateTime" : s_date,
        "endDateTime" : e_date,
        "subject" : subject
    }

    meeting_response = client.post("/users/{user_id}/onlineMeetings",json.dumps(meeting),headers= 
    {'Content-Type': 'application/json'})

    meeting = json.loads(meeting_response.text)

    print(meeting)

I am able to create a meeting, in the same way, using Graph Explorer enter image description here

What am I doing wrong or it's a bug from MS side?

1
Are you trying to use Delegated, or Application permissions? - Hilton Giesenow
There seems to be an issue with access token. How are you generating an access token? Are you appending access token with request? Since, its delegate permission have you tried providing "grant_type:client_credentials". - Manish-MSFT
Okay, it looks that 1.0 API is able to create a meeting for yourself using endpoint "/me/onlineMeetings". I was able to create a meeting using graph explorer because I logged in with the same user I was trying to create a meeting for (used his id in my request). I was able to create a meeting on behalf user with beta API. In order to achieve it you also need to create and grant application access policy to a user . docs.microsoft.com/en-us/powershell/module/skype/… - mike

1 Answers

5
votes

Yes, you are correct, as you said in your comment: the v1.0 endpoint can only call /me api to create a meeting for yourself. If you want to create a meeting for others, you should use the Beta endpoint and then call /users api. ( When you use the beta version , according to the documentation: Administrators must create an application access policy and grant it to a user, authorizing the app configured in the policy to create an online meeting on behalf of that user (user ID specified in the request path).)

Please note: because the call to /users is a call without a user logged in, that is, the application acts as its own entity instead of representing a specific user, so you should grant the application the OnlineMeetings.Read.All application permission, and then give the permission grant the admin consent, and finally you need to use the daemon-based client credential flow to obtain an access token.