How do I get team id after oauth?

Lih Chen 15 Reputation points
2023-02-10T09:19:53.63+00:00

I noticed that some of the API calls I'm about to invoke requires the team_id of the user. How do I get that?
This is a multi tenant app. Hence, I know nothing about the user before hand.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,795 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bhanu Kiran 3,606 Reputation points
    2023-03-24T12:11:41.1666667+00:00

    Hello @Lih Chen ,

    To get user details, please refer to the below endpoint.  

    Get https://graph.microsoft.com/v1.0/users
    

     To get Teams id of the users joined Teams please refer to the below endpoint. 

    GET /users/{id | user-principal-name}/joinedTeams 
    

    111

    Please refer below documentation for more details: 

    https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http  

    https://learn.microsoft.com/en-us/graph/api/user-list-joinedteams?view=graph-rest-1.0&tabs=http  

    Hope this helps.

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

    0 comments No comments

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.