Access to team members in Teams/Channel

AT 41 Reputation points
2022-04-04T13:15:19.88+00:00

Hi,

I wondered how (without admin consent), I can access other members of a channel, or team. So far I've struggled with the Graph API to get access to the members, rather than just the team, or channel. Ideally I'd like to use something like a people picker, but don't want ever user to have to give admin consent.

Thanks

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,583 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,384 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,053 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Prasad-MSFT 6,076 Reputation points Microsoft Vendor
    2022-04-05T08:50:46.58+00:00

    This Method Gets a paginated list of members of one-on-one, group, or team conversation.
    https://learn.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getpagedmembersasync?view=botbuilder-dotnet-stable

       private static async Task<List<TeamsChannelAccount>> GetPagedMembers(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)  
                {  
                    var members = new List<TeamsChannelAccount>();  
                    string continuationToken = null;  
                    do  
                    {  
                        var currentPage = await TeamsInfo.GetPagedMembersAsync(turnContext, 100, continuationToken, cancellationToken);  
                        continuationToken = currentPage.ContinuationToken;  
                        members = members.Concat(currentPage.Members).ToList();  
                    }  
                    while (continuationToken != null);  
                    return members;  
                }  
    
     
    

    Ref: https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/csharp_dotnetcore/57.teams-conversation-bot/Bots/TeamsConversationBot.cs

    Thanks,

    Prasad Das


    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.