0
votes

I'm trying to integrate the MS Teams API in a Web-App. First of all i was trying to use the MS API from Postman to see the workflow.

On the Azure UI i have succesfully created an App-Registration: i have my ClientID, TenantID and i have created also the client secret.

I downloaded the Postman API from https://github.com/microsoftgraph/microsoftgraph-postman-collections and i can retrieve the App-Only Access token.

I created two users in a group and i logged them on MS Teams Application, they can chat.

I can also get the User Access Token and endpoints such

  1. https://graph.microsoft.com/v1.0/users
  2. https://graph.microsoft.com/v1.0/me
  3. etc..

are correctly working.

I am passing the User Access Token as Bearer token for the request.

These are the API permissions i gave: enter image description here

I am having issues with the endpoints in the folder Events like:

  1. https://graph.microsoft.com/beta/me/findRooms
  2. https://graph.microsoft.com/v1.0/me/calendars
  3. etc..

They all give the same error:

{
   "error":{
      "code":"NoUserFoundWithGivenClaims",
      "message":"The user specified by the user-context in the token does not exist.",
      "innerError":{
         "oAuthEventOperationId":"08e3abc3-3fdf-4d85-849d-7632ac0723d2",
         "oAuthEventcV":"CGW24oLIeEW1qoscgMIMTw.1.1",
         "errorUrl":"https://aka.ms/autherrors#error-InvalidUser",
         "requestId":"8e6cb242-17fe-4a94-8c89-912606578fb3",
         "date":"2021-03-09T12:04:27"
      }
   }
} 

I haven't found anything about this error. Can someone help me? Thanks.

1
Are you calling the /findRoom and /calendar API's using App only access token?Shiva Keshav Varma
Hi @ShivaKeshavVarma thanks for the answer. No, i am calling it passing these: ClientID, ClientSecret, TenantID, AppAccessToken, UserPassword & UserName (of the current user), UserAccessToken, UserId, TeamId, SiteId. Should i only pass the App only access token?AndreC23
Check your bearer token by putting it in jwt.ms and see if you have the required permissions in 'scp' claim.Shiva Keshav Varma
You were right, only passing the Token the API is working. But now there is one other problem, the api response with this error: { "error": { "code": "MailboxNotEnabledForRESTAPI", "message": "REST API is not yet supported for this mailbox." } }AndreC23
Check if you have proper exchange license added to the users which you are logging in with.Shiva Keshav Varma

1 Answers

1
votes

You can check your bearer token by putting it in jwt.ms and see if you have the required permissions in 'scp' claim.

If you are getting MailboxNotEnabledForRESTAPI then you need to check if you have the proper exchange license or not.

You can add license by going into Microsoft Admin Center -> Users -> Active Users -> Select your user -> Licenses