question

AT-7039 avatar image
0 Votes"
AT-7039 asked ChetanSharmamsft-3456 commented

Access to team members in Teams/Channel

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

office-teams-windows-itprooffice-teams-app-devmicrosoft-graph-teamworkmicrosoft-graph-sdkmicrosoft-graph-notifications
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Could you please provide more details what you are trying to achieve here?

0 Votes 0 ·

Hi @Prasad-MSFT ,
So an app (which is added to a channel/team as a tab app) with a set group of members who can approve tasks. How can I access other members of a team/channel from the graph api? So far I have access to things like my own emails, and my user profile, but want to access other users in that team/channel (and use something like the people picker I mentioned below, to select members to approve tasks). We want to avoid admin consent for all members if possible.

0 Votes 0 ·

1 Answer

Prasad-MSFT avatar image
0 Votes"
Prasad-MSFT answered ChetanSharmamsft-3456 commented

This Method Gets a paginated list of members of one-on-one, group, or team conversation.
https://docs.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.





· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AT-7039 - If above answer is helpful, could you please accept it for more visibility?

0 Votes 0 ·