Search code examples
microsoft-graph-apimicrosoft-teamsmicrosoft-graph-sdksmicrosoft-graph-teams

Graph API, getting Team/Channel members from private channel


I need to get the list of members from a SPA that is hosted as a tab in a private channel in Microsoft Teams. I know how to query it from this page. So the request is something like this: GET https://graph.microsoft.com/beta/teams/<group_id>/channels/<channel_id>/members The problem is from the SPA I couldn't get the groupId because in a private channel the context provided by Microsoft Teams SDK is undefined. I know that this is done to provide privacy for the channel. But, are there any other queries that I could use to get the members, or is there any other way to get groupId from a private channel?


Solution

  • Copying Answer from the comments

    To get the list of members from a private channel, you can call GET graph.microsoft.com/v1.0/me/joinedteams and get the corresponding Team ID/Group ID and call GET graph.microsoft.com/v1.0/Teams{groupID}/channels/{PrivateChannelID}/members