Forum Discussion
How to get list of channels and members in teams bot
- Oct 09, 2024The TeamsInfo.GetPagedMembersAsync(turnContext) method can be used in various activities, not just in onConversationUpdate. This method is designed to fetch a paginated list of members from a one-on-one, group, or team conversation. It is not limited to being set up in onConversationUpdate.
You can indeed utilize it in the onMessage handler or any other activity handler. When you pass the context received to GetPagedMembersAsync, it will provide the full list of members that are part of the team, not just the members involved in the specific conversation. This method is particularly useful for handling large teams, as it supports pagination to manage the retrieval of members efficiently.
I already mentioned i used that `turncontext` and u can see i received a response too but its has undefined as value also how to generate context token for teams rsc permissions .If you can provide me specific code or some snippet which i can follow else i am already fed up with Microsoft clueless support
yashgandhi - Approach to get the list of channels in a team is mentioned here in this section https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/get-teams-context?tabs=dotnet#get-the-list-of-channels-in-a-team. The name of the default General channel is returned as null, are you getting undefined for general channel.
Could you please let us know your RSC permission requirement, meanwhile we have few sample which use RSC.
Microsoft-Teams-Samples/samples/graph-rsc at main · OfficeDev/Microsoft-Teams-Samples (github.com)
- yashgandhiOct 05, 2024Copper ContributorYes channel name i changed to general 2 still it is returning undefined
Also i want to get list of channels proactive so i dont have turncontext. and when i generate token with rsc context it not work- yashgandhiOct 05, 2024Copper ContributorAfter lot of debugging the app u shared as an exmaple and the app i created have some difference in generated tokens. The toke i generated is missing in jwt token `roles:[Group.Selected]` now u know what could be i am missing so its not working ?
- Meghana-MSFTOct 08, 2024Former Employee
yashgandhi - Just to clarify you want to fetch a complete list of members and channels in a team where your bot is installed using RSC. You do not want to use the methods mentioned here https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/get-teams-context?tabs=dotnet#get-the-list-of-channels-in-a-team.
Could you please confirm so that we can check for possible workarounds?