How to Retrieve User Joined Teams in Microsoft Teams JavaScript Library

68 views Asked by At

I'm trying to work with the Microsoft Teams JavaScript Library, and I've noticed in the documentation that there's a callback called teams.fullTrust.joinedTeams.getUserJoinedTeams for retrieving user joined teams.

https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/using-teams-client-library?tabs=javascript%2Cmanifest-teams-toolkit#callbacks-converted-to-promises

However, when I inspected context.teams in the Teams JavaScript library, I couldn't find a built-in function to retrieve user joined teams. Is there a built-in function or an alternative approach to achieve this?

1

There are 1 answers

0
SaiPratap-MSFT On

you can achieve this by using the Microsoft Graph API. Microsoft Graph API provides two HTTP GET methods to retrieve the teams that a user is a part of:

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

These methods return a list of team resources that the user is a part of