From cf9dd7f2dbcfdc7ca91dab3cfb82f538b2fff5c7 Mon Sep 17 00:00:00 2001 From: Pranjal-MSFT Date: Tue, 24 Mar 2026 16:51:55 +0530 Subject: [PATCH 1/8] Update get-teams-context.md --- .../bots/how-to/get-teams-context.md | 239 +++++++----------- 1 file changed, 94 insertions(+), 145 deletions(-) diff --git a/msteams-platform/bots/how-to/get-teams-context.md b/msteams-platform/bots/how-to/get-teams-context.md index f6af0354542..ac354ec3f5e 100644 --- a/msteams-platform/bots/how-to/get-teams-context.md +++ b/msteams-platform/bots/how-to/get-teams-context.md @@ -4,7 +4,7 @@ description: Get Teams specific context for your bot, fetch user profile, get si ms.topic: conceptual ms.localizationpriority: high ms.owner: angovil -ms.date: 03/16/2026 +ms.date: 03/24/2026 --- # Get Teams specific context for your bot @@ -30,23 +30,13 @@ The following sample code uses the paged endpoint for fetching the roster: * [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/graph-proactive-installation/csharp/ProactiveAppInstallation/Bots/ProactiveBot.cs#L78) ```csharp -public class MyBot : TeamsActivityHandler +app.OnMessage(async context => { - protected override async Task OnMessageActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken) - { - var members = new List(); - string continuationToken = null; - - do - { - // Gets a paginated list of members of one-on-one, group, or team conversation. - var currentPage = await TeamsInfo.GetPagedMembersAsync(turnContext, 100, continuationToken, cancellationToken); - continuationToken = currentPage.ContinuationToken; - members.AddRange(currentPage.Members); - } - while (continuationToken != null); - } -} + var conversationId = context.Activity.Conversation.Id; + + // Gets all members of the conversation. + var members = await context.Api.Conversations.Members.GetAsync(conversationId); +}); ``` # [TypeScript](#tab/typescript) @@ -56,28 +46,12 @@ public class MyBot : TeamsActivityHandler * [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/graph-proactive-installation/nodejs/bots/proactiveBot.js#L38) ```typescript -export class MyBot extends TeamsActivityHandler { - constructor() { - super(); - - // See https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0 to learn more about the message and other activity types. - this.onMessage(async (turnContext, next) => { - var continuationToken; - var members = []; - - do { - // Gets a paginated list of members of one-on-one, group, or team conversation. - var pagedMembers = await TeamsInfo.getPagedMembers(turnContext, 100, continuationToken); - continuationToken = pagedMembers.continuationToken; - members.push(...pagedMembers.members); - } - while(continuationToken !== undefined) - - // By calling next() you ensure that the next BotHandler is run. - await next(); - }); - } -} +app.on('message', async ({ activity, api }) => { + const conversationId = activity.conversation.id; + + // Gets all members of the conversation. + const members = await api.conversations.members(conversationId).get(); +}); ``` # [Python](#tab/python) @@ -85,11 +59,12 @@ export class MyBot extends TeamsActivityHandler { [SDK reference](/python/api/botbuilder-core/botbuilder.core.teams.teamsinfo?view=botbuilder-py-latest&preserve-view=true#botbuilder-core-teams-teamsinfo-get-team-members) ```python -async def _show_members( - self, turn_context: TurnContext -): - # Get a conversationMember from a team. - members = await TeamsInfo.get_team_members(turn_context) +@app.on_message +async def handle_message(ctx: ActivityContext[MessageActivity]): + conversation_id = ctx.activity.conversation.id + + # Gets all members of the conversation. + members = await ctx.api.conversations.members(conversation_id).get_all() ``` # [JSON](#tab/json) @@ -150,15 +125,14 @@ The following sample code is used to get single member details: * [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-sequential-flow-adaptive-cards/csharp/SequentialUserSpecificFlow/Bots/UserSpecificBot.cs#L37) ```csharp -public class MyBot : TeamsActivityHandler +app.OnMessage(async context => { - protected override async Task OnMessageActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken) - { - // Gets the account of a single conversation member. - // This works in one-on-one, group, and team scoped conversations. - var member = await TeamsInfo.GetMemberAsync(turnContext, turnContext.Activity.From.Id, cancellationToken); - } -} + var conversationId = context.Activity.Conversation.Id; + var memberId = context.Activity.From.Id; + + // Gets a single member by ID. + var member = await context.Api.Conversations.Members.GetByIdAsync(conversationId, memberId); +}); ``` # [TypeScript](#tab/typescript) @@ -168,19 +142,13 @@ public class MyBot : TeamsActivityHandler * [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-conversation/nodejs/bots/teamsConversationBot.js#L186) ```typescript -export class MyBot extends TeamsActivityHandler { - constructor() { - super(); +app.on('message', async ({ activity, api }) => { + const conversationId = activity.conversation.id; + const memberId = activity.from.id; - // See learn.microsoft.com/en-us/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0 to learn more about the message and other activity types. - this.onMessage(async (turnContext, next) => { - const member = await TeamsInfo.getMember(turnContext, encodeURI('someone@somecompany.com')); - - // By calling next() you ensure that the next BotHandler is run. - await next(); - }); - } -} + // Gets a single member by ID. + const member = await api.conversations.members(conversationId).getById(memberId); +}); ``` # [Python](#tab/python) @@ -190,11 +158,13 @@ export class MyBot extends TeamsActivityHandler { * [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-conversation/python/bots/teams_conversation_bot.py#L67) ```python -async def _show_members( - self, turn_context: TurnContext -): - # TeamsInfo.get_member: Gets the member of a team scoped conversation. - member = await TeamsInfo.get_member(turn_context, turn_context.activity.from_property.id) +@app.on_message +async def handle_message(ctx: ActivityContext[MessageActivity]): + conversation_id = ctx.activity.conversation.id + member_id = ctx.activity.from_.id + + # Gets a single member by ID. + member = await ctx.api.conversations.members(conversation_id).get(member_id) ``` # [JSON](#tab/json) @@ -250,22 +220,21 @@ The following sample code is used to get team's details: * [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/TeamsJS/msteams-application-qbot/Source/Microsoft.Teams.Apps.QBot.Web/Bot/QBotTeamInfo.cs#L44) ```csharp -public class MyBot : TeamsActivityHandler +app.OnMessage(async context => { - protected override async Task OnMessageActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken) + var teamId = context.Activity.ChannelData?.Team?.Id; + + if (teamId != null) { - // Gets the details for the given team id. This only works in team scoped conversations. - // TeamsGetTeamInfo: Gets the TeamsInfo object from the current activity. - TeamDetails teamDetails = await TeamsInfo.GetTeamDetailsAsync(turnContext, turnContext.Activity.TeamsGetTeamInfo().Id, cancellationToken); - if (teamDetails != null) { - await turnContext.SendActivityAsync($"The groupId is: {teamDetails.AadGroupId}"); - } - else { - // Sends a message activity to the sender of the incoming activity. - await turnContext.SendActivityAsync($"Message did not come from a channel in a team."); - } + // Gets team details by ID. + var teamDetails = await context.Api.Teams.GetByIdAsync(teamId); + await context.Send($"The groupId is: {teamDetails.AadGroupId}"); } -} + else + { + await context.Send("Message did not come from a channel in a team."); + } +}); ``` # [TypeScript](#tab/typescript) @@ -275,28 +244,17 @@ public class MyBot : TeamsActivityHandler * [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/app-complete-sample/nodejs/server/dialogs/teams/fetchTeamInfoDialog.js#L21) ```typescript -export class MyBot extends TeamsActivityHandler { - constructor() { - super(); - - // See https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0 to learn more about the message and other activity types. - this.onMessage(async (turnContext, next) => { - - // Gets the details for the given team id. - const teamDetails = await TeamsInfo.getTeamDetails(turnContext); - if (teamDetails) { - - // Sends a message activity to the sender of the incoming activity. - await turnContext.sendActivity(`The group ID is: ${teamDetails.aadGroupId}`); - } else { - await turnContext.sendActivity('This message did not come from a channel in a team.'); - } - - // By calling next() you ensure that the next BotHandler is run. - await next(); - }); +app.on('message', async ({ activity, api, send }) => { + const teamId = activity.channelData?.team?.id; + + if (teamId) { + // Gets team details by ID. + const teamDetails = await api.teams.getById(teamId); + await send(`The group ID is: ${teamDetails.aadGroupId}`); + } else { + await send('This message did not come from a channel in a team.'); } -} +}); ``` # [Python](#tab/python) @@ -304,16 +262,16 @@ export class MyBot extends TeamsActivityHandler { [SDK reference](/python/api/botbuilder-core/botbuilder.core.teams.teamsinfo?view=botbuilder-py-latest&preserve-view=true#botbuilder-core-teams-teamsinfo-get-team-details) ```python -async def _show_details(self, turn_context: TurnContext): - - # Gets the details for the given team id. - team_details = await TeamsInfo.get_team_details(turn_context) - - # MessageFactory.text(): Specifies the type of text data in a message attachment. - reply = MessageFactory.text(f"The team name is {team_details.name}. The team ID is {team_details.id}. The AADGroupID is {team_details.aad_group_id}.") - - # Sends a message activity to the sender of the incoming activity. - await turn_context.send_activity(reply) +@app.on_message +async def handle_message(ctx: ActivityContext[MessageActivity]): + team_id = ctx.activity.channel_data.get("team", {}).get("id") if ctx.activity.channel_data else None + + if team_id: + # Gets team details by ID. + team_details = await ctx.api.teams.get_by_id(team_id) + await ctx.send(f"The team name is {team_details.name}. The AADGroupID is {team_details.aad_group_id}.") + else: + await ctx.send("Message did not come from a channel in a team.") ``` # [JSON](#tab/json) @@ -353,18 +311,17 @@ The following sample code is used to get the list of channels in a team: * [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/TeamsJS/msteams-application-qbot/Source/Microsoft.Teams.Apps.QBot.Web/Bot/QBotTeamInfo.cs#L57) ```csharp -public class MyBot : TeamsActivityHandler +app.OnMessage(async context => { - // Override this in a derived class to provide logic specific to Message activities. - protected override async Task OnMessageActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken) - { - // Returns a list of channels in a Team. This only works in team scoped conversations. - IEnumerable channels = await TeamsInfo.GetTeamChannelsAsync(turnContext, turnContext.Activity.TeamsGetTeamInfo().Id, cancellationToken); + var teamId = context.Activity.ChannelData?.Team?.Id; - // Sends a message activity to the sender of the incoming activity. - await turnContext.SendActivityAsync($"The channel count is: {channels.Count()}"); + if (teamId != null) + { + // Gets channels (conversations) for the team. + var channels = await context.Api.Teams.GetConversationsAsync(teamId); + await context.Send($"The channel count is: {channels.Count}"); } -} +}); ``` # [TypeScript](#tab/typescript) @@ -372,24 +329,15 @@ public class MyBot : TeamsActivityHandler [SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getteamchannels) ```typescript -export class MyBot extends TeamsActivityHandler { - constructor() { - super(); - - // See https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0 to learn more about the message and other activity types. - this.onMessage(async (turnContext, next) => { +app.on('message', async ({ activity, api, send }) => { + const teamId = activity.channelData?.team?.id; - // Supports retrieving channels hosted by a team. - const channels = await TeamsInfo.getTeamChannels(turnContext); - - // Sends a message activity to the sender of the incoming activity. - await turnContext.sendActivity(`The channel count is: ${channels.length}`); - - // By calling next() you ensure that the next BotHandler is run. - await next(); - }); + if (teamId) { + // Gets channels (conversations) for the team. + const channels = await api.teams.getConversations(teamId); + await send(`The channel count is: ${channels.length}`); } -} +}); ``` # [Python](#tab/python) @@ -397,13 +345,14 @@ export class MyBot extends TeamsActivityHandler { [SDK reference](/python/api/botbuilder-core/botbuilder.core.teams.teamsinfo?view=botbuilder-py-latest&preserve-view=true#botbuilder-core-teams-teamsinfo-get-team-channels) ```python -async def _show_channels( - self, turn_context: TurnContext -): - # Supports retrieving channels hosted by a team. - channels = await TeamsInfo.get_team_channels(turn_context) - reply = MessageFactory.text(f"Total of {len(channels)} channels are currently in team") - await turn_context.send_activity(reply) +@app.on_message +async def handle_message(ctx: ActivityContext[MessageActivity]): + team_id = ctx.activity.channel_data.get("team", {}).get("id") if ctx.activity.channel_data else None + + if team_id: + # Gets channels (conversations) for the team. + channels = await ctx.api.teams.get_conversations(team_id) + await ctx.send(f"Total of {len(channels)} channels are currently in team") ``` # [JSON](#tab/json) From b476d30c53d158617bc57df62ba69ce0a4bc7f8a Mon Sep 17 00:00:00 2001 From: Pranjal-MSFT Date: Fri, 27 Mar 2026 08:45:46 +0530 Subject: [PATCH 2/8] Update get-teams-context.md --- .../bots/how-to/get-teams-context.md | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/msteams-platform/bots/how-to/get-teams-context.md b/msteams-platform/bots/how-to/get-teams-context.md index ac354ec3f5e..18084d4f155 100644 --- a/msteams-platform/bots/how-to/get-teams-context.md +++ b/msteams-platform/bots/how-to/get-teams-context.md @@ -4,12 +4,10 @@ description: Get Teams specific context for your bot, fetch user profile, get si ms.topic: conceptual ms.localizationpriority: high ms.owner: angovil -ms.date: 03/24/2026 +ms.date: 03/25/2026 --- # Get Teams specific context for your bot -[!INCLUDE [pre-release-label](~/includes/v4-to-v3-pointer-bots.md)] - A bot can access additional context data about a team or chat where it's installed. This information can be used to enrich the bot's functionality and provide a more personalized experience. ## Fetch the roster or user profile @@ -27,8 +25,6 @@ The following sample code uses the paged endpoint for fetching the roster: * [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getpagedmembersasync?view=botbuilder-dotnet-stable&preserve-view=true) -* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/graph-proactive-installation/csharp/ProactiveAppInstallation/Bots/ProactiveBot.cs#L78) - ```csharp app.OnMessage(async context => { @@ -43,8 +39,6 @@ app.OnMessage(async context => * [SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getpagedmembers) -* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/graph-proactive-installation/nodejs/bots/proactiveBot.js#L38) - ```typescript app.on('message', async ({ activity, api }) => { const conversationId = activity.conversation.id; @@ -110,7 +104,7 @@ Response body * * * -After you fetch the roster or user profile, you can get details of a single member. To retrieve information for one or more members of a chat or team, use the Microsoft Teams bot APIs `TeamsInfo.GetMembersAsync` for C# or `TeamsInfo.getMembers` for TypeScript APIs. +After you fetch the roster or user profile, you can get details of a single member. To retrieve information for one or more members of a chat or team, use the Microsoft Teams bot APIs `context.Api.Conversations.Members.GetAsync(conversationId)` for C# or `api.conversations.members(conversationId).get()` for TypeScript APIs. ## Get single member details @@ -122,8 +116,6 @@ The following sample code is used to get single member details: * [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getmemberasync?view=botbuilder-dotnet-stable&preserve-view=true) -* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-sequential-flow-adaptive-cards/csharp/SequentialUserSpecificFlow/Bots/UserSpecificBot.cs#L37) - ```csharp app.OnMessage(async context => { @@ -139,8 +131,6 @@ app.OnMessage(async context => * [SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getmember) -* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-conversation/nodejs/bots/teamsConversationBot.js#L186) - ```typescript app.on('message', async ({ activity, api }) => { const conversationId = activity.conversation.id; @@ -155,8 +145,6 @@ app.on('message', async ({ activity, api }) => { * [SDK reference](/python/api/botbuilder-core/botbuilder.core.teams.teamsinfo?view=botbuilder-py-latest&preserve-view=true#botbuilder-core-teams-teamsinfo-get-member) -* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-conversation/python/bots/teams_conversation_bot.py#L67) - ```python @app.on_message async def handle_message(ctx: ActivityContext[MessageActivity]): @@ -205,7 +193,7 @@ Response body * * * -After you get details of a single member, you can get details of the team. To retrieve information for a team, use the Teams bot APIs `TeamsInfo.GetMemberDetailsAsync` for C# or `TeamsInfo.getTeamDetails` for TypeScript. +After you get details of a single member, you can get details of the team. To retrieve information for a team, use the Teams bot APIs `context.Api.Conversations.Members.GetByIdAsync(conversationId, memberId)` for C# or `api.conversations.members(conversationId).getById(memberId)` for TypeScript. ## Get team's details @@ -217,8 +205,6 @@ The following sample code is used to get team's details: * [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getteamdetailsasync?view=botbuilder-dotnet-stable&preserve-view=true) -* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/TeamsJS/msteams-application-qbot/Source/Microsoft.Teams.Apps.QBot.Web/Bot/QBotTeamInfo.cs#L44) - ```csharp app.OnMessage(async context => { @@ -241,8 +227,6 @@ app.OnMessage(async context => * [SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getteamdetails) -* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/app-complete-sample/nodejs/server/dialogs/teams/fetchTeamInfoDialog.js#L21) - ```typescript app.on('message', async ({ activity, api, send }) => { const teamId = activity.channelData?.team?.id; @@ -291,7 +275,7 @@ Response body * * * -After you get details of the team, you can get the list of channels in a team. To retrieve information for a list of channels in a team, use the Teams bot APIs `TeamsInfo.GetTeamChannelsAsync` for C# or `TeamsInfo.getTeamChannels` for TypeScript APIs. +After you get details of the team, you can get the list of channels in a team. To retrieve information for a list of channels in a team, use the Teams bot APIs `context.Api.Teams.GetByIdAsync(teamId)` for C# or `api.teams.getById(teamId)` for TypeScript APIs. ## Get the list of channels in a team @@ -308,8 +292,6 @@ The following sample code is used to get the list of channels in a team: * [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getteamchannelsasync?view=botbuilder-dotnet-stable&preserve-view=true) -* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/TeamsJS/msteams-application-qbot/Source/Microsoft.Teams.Apps.QBot.Web/Bot/QBotTeamInfo.cs#L57) - ```csharp app.OnMessage(async context => { From 74e4bd1a8028179944ba3562bd21e361e10f4d29 Mon Sep 17 00:00:00 2001 From: Pranjal-MSFT Date: Mon, 30 Mar 2026 12:28:19 +0530 Subject: [PATCH 3/8] Update get-teams-context.md --- .../bots/how-to/get-teams-context.md | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/msteams-platform/bots/how-to/get-teams-context.md b/msteams-platform/bots/how-to/get-teams-context.md index 18084d4f155..f27c91ee272 100644 --- a/msteams-platform/bots/how-to/get-teams-context.md +++ b/msteams-platform/bots/how-to/get-teams-context.md @@ -4,7 +4,7 @@ description: Get Teams specific context for your bot, fetch user profile, get si ms.topic: conceptual ms.localizationpriority: high ms.owner: angovil -ms.date: 03/25/2026 +ms.date: 03/30/2026 --- # Get Teams specific context for your bot @@ -12,7 +12,7 @@ A bot can access additional context data about a team or chat where it's install ## Fetch the roster or user profile -Your bot can query for the list of members and their basic user profiles, including Teams user IDs and Microsoft Entra information, such as name and objectId. You can use this information to correlate user identities. For example, to check whether a user logged into a tab through Microsoft Entra credentials is a member of the team. For get conversation members, minimum or maximum page size depends on the implementation. Page size less than 50, are treated as 50, and greater than 500, are capped at 500. Even if you use the non-paged version, it's unreliable in large teams and must not be used. For more information, see [changes to Teams Bot APIs for fetching team or chat members](~/resources/team-chat-member-api-changes.md). +Your bot can query for the list of members and their basic user profiles, including Teams user IDs and Microsoft Entra information, such as name and objectId. You can use this information to correlate user identities. For example, to check whether a user logged into a tab through Microsoft Entra credentials is a member of the team. For get conversation members, minimum or maximum page size depends on the implementation. Page size less than 50, are treated as 50, and greater than 500, are capped at 500. Even if you use the non-paged version, it's unreliable in large teams and must not be used. > [!NOTE] > @@ -23,8 +23,6 @@ The following sample code uses the paged endpoint for fetching the roster: # [C#](#tab/dotnet) -* [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getpagedmembersasync?view=botbuilder-dotnet-stable&preserve-view=true) - ```csharp app.OnMessage(async context => { @@ -37,8 +35,6 @@ app.OnMessage(async context => # [TypeScript](#tab/typescript) -* [SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getpagedmembers) - ```typescript app.on('message', async ({ activity, api }) => { const conversationId = activity.conversation.id; @@ -50,8 +46,6 @@ app.on('message', async ({ activity, api }) => { # [Python](#tab/python) -[SDK reference](/python/api/botbuilder-core/botbuilder.core.teams.teamsinfo?view=botbuilder-py-latest&preserve-view=true#botbuilder-core-teams-teamsinfo-get-team-members) - ```python @app.on_message async def handle_message(ctx: ActivityContext[MessageActivity]): @@ -114,8 +108,6 @@ The following sample code is used to get single member details: # [C#](#tab/dotnet) -* [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getmemberasync?view=botbuilder-dotnet-stable&preserve-view=true) - ```csharp app.OnMessage(async context => { @@ -129,8 +121,6 @@ app.OnMessage(async context => # [TypeScript](#tab/typescript) -* [SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getmember) - ```typescript app.on('message', async ({ activity, api }) => { const conversationId = activity.conversation.id; @@ -143,8 +133,6 @@ app.on('message', async ({ activity, api }) => { # [Python](#tab/python) -* [SDK reference](/python/api/botbuilder-core/botbuilder.core.teams.teamsinfo?view=botbuilder-py-latest&preserve-view=true#botbuilder-core-teams-teamsinfo-get-member) - ```python @app.on_message async def handle_message(ctx: ActivityContext[MessageActivity]): @@ -203,8 +191,6 @@ The following sample code is used to get team's details: # [C#](#tab/dotnet) -* [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getteamdetailsasync?view=botbuilder-dotnet-stable&preserve-view=true) - ```csharp app.OnMessage(async context => { @@ -225,8 +211,6 @@ app.OnMessage(async context => # [TypeScript](#tab/typescript) -* [SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getteamdetails) - ```typescript app.on('message', async ({ activity, api, send }) => { const teamId = activity.channelData?.team?.id; @@ -243,8 +227,6 @@ app.on('message', async ({ activity, api, send }) => { # [Python](#tab/python) -[SDK reference](/python/api/botbuilder-core/botbuilder.core.teams.teamsinfo?view=botbuilder-py-latest&preserve-view=true#botbuilder-core-teams-teamsinfo-get-team-details) - ```python @app.on_message async def handle_message(ctx: ActivityContext[MessageActivity]): @@ -290,8 +272,6 @@ The following sample code is used to get the list of channels in a team: # [C#](#tab/dotnet) -* [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getteamchannelsasync?view=botbuilder-dotnet-stable&preserve-view=true) - ```csharp app.OnMessage(async context => { @@ -308,8 +288,6 @@ app.OnMessage(async context => # [TypeScript](#tab/typescript) -[SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getteamchannels) - ```typescript app.on('message', async ({ activity, api, send }) => { const teamId = activity.channelData?.team?.id; @@ -324,8 +302,6 @@ app.on('message', async ({ activity, api, send }) => { # [Python](#tab/python) -[SDK reference](/python/api/botbuilder-core/botbuilder.core.teams.teamsinfo?view=botbuilder-py-latest&preserve-view=true#botbuilder-core-teams-teamsinfo-get-team-channels) - ```python @app.on_message async def handle_message(ctx: ActivityContext[MessageActivity]): From a7bd942962fd00f7f6619e7085bf0111da70c0c2 Mon Sep 17 00:00:00 2001 From: Pranjal-MSFT Date: Mon, 30 Mar 2026 13:02:14 +0530 Subject: [PATCH 4/8] Update get-teams-context.md --- msteams-platform/bots/how-to/get-teams-context.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msteams-platform/bots/how-to/get-teams-context.md b/msteams-platform/bots/how-to/get-teams-context.md index f27c91ee272..257dd2d1792 100644 --- a/msteams-platform/bots/how-to/get-teams-context.md +++ b/msteams-platform/bots/how-to/get-teams-context.md @@ -98,7 +98,7 @@ Response body * * * -After you fetch the roster or user profile, you can get details of a single member. To retrieve information for one or more members of a chat or team, use the Microsoft Teams bot APIs `context.Api.Conversations.Members.GetAsync(conversationId)` for C# or `api.conversations.members(conversationId).get()` for TypeScript APIs. +After you fetch the roster or user profile, you can get details of a single member. To retrieve information for one or more specific members of a chat or team, use the Microsoft Teams bot APIs `context.Api.Conversations.Members.GetByIdAsync(conversationId, memberId)` for C# or `api.conversations.members(conversationId).getById(memberId)` for TypeScript APIs. ## Get single member details @@ -181,7 +181,7 @@ Response body * * * -After you get details of a single member, you can get details of the team. To retrieve information for a team, use the Teams bot APIs `context.Api.Conversations.Members.GetByIdAsync(conversationId, memberId)` for C# or `api.conversations.members(conversationId).getById(memberId)` for TypeScript. +After you get details of a single member, you can get details of the team. To retrieve information for a team, use the Teams bot APIs `context.Api.Teams.GetByIdAsync(teamId)` for C# or `api.teams.getById(teamId)` for TypeScript. ## Get team's details From 99ac2d630e8ed453ae397459d89a8512399bc46e Mon Sep 17 00:00:00 2001 From: Pranjal-MSFT Date: Tue, 31 Mar 2026 14:49:55 +0530 Subject: [PATCH 5/8] Update get-teams-context.md --- msteams-platform/bots/how-to/get-teams-context.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/msteams-platform/bots/how-to/get-teams-context.md b/msteams-platform/bots/how-to/get-teams-context.md index 257dd2d1792..d96217ac70b 100644 --- a/msteams-platform/bots/how-to/get-teams-context.md +++ b/msteams-platform/bots/how-to/get-teams-context.md @@ -4,7 +4,7 @@ description: Get Teams specific context for your bot, fetch user profile, get si ms.topic: conceptual ms.localizationpriority: high ms.owner: angovil -ms.date: 03/30/2026 +ms.date: 03/31/2026 --- # Get Teams specific context for your bot @@ -12,14 +12,9 @@ A bot can access additional context data about a team or chat where it's install ## Fetch the roster or user profile -Your bot can query for the list of members and their basic user profiles, including Teams user IDs and Microsoft Entra information, such as name and objectId. You can use this information to correlate user identities. For example, to check whether a user logged into a tab through Microsoft Entra credentials is a member of the team. For get conversation members, minimum or maximum page size depends on the implementation. Page size less than 50, are treated as 50, and greater than 500, are capped at 500. Even if you use the non-paged version, it's unreliable in large teams and must not be used. +Your bot can query for the list of members and their basic user profiles, including Teams user IDs and Microsoft Entra information, such as name and objectId. You can use this information to correlate user identities. For example, to check whether a user logged into a tab through Microsoft Entra credentials is a member of the team. -> [!NOTE] -> -> * Pagination is available in a team and a channel. -> * Pagination isn't supported in chats. For chats, the entire roster is always returned. - -The following sample code uses the paged endpoint for fetching the roster: +The following sample code is used for fetching the roster: # [C#](#tab/dotnet) @@ -257,7 +252,7 @@ Response body * * * -After you get details of the team, you can get the list of channels in a team. To retrieve information for a list of channels in a team, use the Teams bot APIs `context.Api.Teams.GetByIdAsync(teamId)` for C# or `api.teams.getById(teamId)` for TypeScript APIs. +After you get details of the team, you can get the list of channels in a team. To retrieve information for a list of channels in a team, use the Teams bot APIs `context.Api.Teams.GetConversationsAsync(teamId)` for C# or `api.teams.getConversations(teamId)` for TypeScript APIs. ## Get the list of channels in a team From 7190360075943dd9718cc37c515823d382322dd1 Mon Sep 17 00:00:00 2001 From: Pranjal-MSFT Date: Wed, 1 Apr 2026 08:36:08 +0530 Subject: [PATCH 6/8] Update get-teams-context.md --- msteams-platform/bots/how-to/get-teams-context.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/msteams-platform/bots/how-to/get-teams-context.md b/msteams-platform/bots/how-to/get-teams-context.md index d96217ac70b..fc2d6505c6e 100644 --- a/msteams-platform/bots/how-to/get-teams-context.md +++ b/msteams-platform/bots/how-to/get-teams-context.md @@ -335,8 +335,6 @@ Response body * * * -[!INCLUDE [sample](~/includes/bots/teams-bot-samples.md)] - ## Next step > [!div class="nextstepaction"] From 69072723a25715a4c32c405cc6bf65c9bcb5e99e Mon Sep 17 00:00:00 2001 From: Pranjal-MSFT Date: Mon, 6 Apr 2026 11:14:39 +0530 Subject: [PATCH 7/8] Update get-teams-context.md --- .../bots/how-to/get-teams-context.md | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/msteams-platform/bots/how-to/get-teams-context.md b/msteams-platform/bots/how-to/get-teams-context.md index fc2d6505c6e..302ac5265af 100644 --- a/msteams-platform/bots/how-to/get-teams-context.md +++ b/msteams-platform/bots/how-to/get-teams-context.md @@ -4,7 +4,7 @@ description: Get Teams specific context for your bot, fetch user profile, get si ms.topic: conceptual ms.localizationpriority: high ms.owner: angovil -ms.date: 03/31/2026 +ms.date: 04/06/2026 --- # Get Teams specific context for your bot @@ -18,6 +18,8 @@ The following sample code is used for fetching the roster: # [C#](#tab/dotnet) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=csharp) + ```csharp app.OnMessage(async context => { @@ -30,6 +32,8 @@ app.OnMessage(async context => # [TypeScript](#tab/typescript) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=typescript) + ```typescript app.on('message', async ({ activity, api }) => { const conversationId = activity.conversation.id; @@ -41,6 +45,8 @@ app.on('message', async ({ activity, api }) => { # [Python](#tab/python) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=python) + ```python @app.on_message async def handle_message(ctx: ActivityContext[MessageActivity]): @@ -103,6 +109,8 @@ The following sample code is used to get single member details: # [C#](#tab/dotnet) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=csharp) + ```csharp app.OnMessage(async context => { @@ -116,6 +124,8 @@ app.OnMessage(async context => # [TypeScript](#tab/typescript) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=typescript) + ```typescript app.on('message', async ({ activity, api }) => { const conversationId = activity.conversation.id; @@ -128,6 +138,8 @@ app.on('message', async ({ activity, api }) => { # [Python](#tab/python) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=python) + ```python @app.on_message async def handle_message(ctx: ActivityContext[MessageActivity]): @@ -186,6 +198,8 @@ The following sample code is used to get team's details: # [C#](#tab/dotnet) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=csharp) + ```csharp app.OnMessage(async context => { @@ -206,6 +220,8 @@ app.OnMessage(async context => # [TypeScript](#tab/typescript) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=typescript) + ```typescript app.on('message', async ({ activity, api, send }) => { const teamId = activity.channelData?.team?.id; @@ -222,6 +238,8 @@ app.on('message', async ({ activity, api, send }) => { # [Python](#tab/python) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=python) + ```python @app.on_message async def handle_message(ctx: ActivityContext[MessageActivity]): @@ -267,6 +285,8 @@ The following sample code is used to get the list of channels in a team: # [C#](#tab/dotnet) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=csharp) + ```csharp app.OnMessage(async context => { @@ -283,6 +303,8 @@ app.OnMessage(async context => # [TypeScript](#tab/typescript) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=typescript) + ```typescript app.on('message', async ({ activity, api, send }) => { const teamId = activity.channelData?.team?.id; @@ -297,6 +319,8 @@ app.on('message', async ({ activity, api, send }) => { # [Python](#tab/python) +* [SDK reference](/microsoftteams/platform/teams-sdk/essentials/api?pivots=python) + ```python @app.on_message async def handle_message(ctx: ActivityContext[MessageActivity]): From 65ae553013507b2adc7c2c16237d6e0e4a8a3841 Mon Sep 17 00:00:00 2001 From: Pranjal-MSFT Date: Thu, 9 Apr 2026 11:53:54 +0530 Subject: [PATCH 8/8] Update get-teams-context.md --- msteams-platform/bots/how-to/get-teams-context.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/msteams-platform/bots/how-to/get-teams-context.md b/msteams-platform/bots/how-to/get-teams-context.md index 302ac5265af..bc421c9e621 100644 --- a/msteams-platform/bots/how-to/get-teams-context.md +++ b/msteams-platform/bots/how-to/get-teams-context.md @@ -4,7 +4,7 @@ description: Get Teams specific context for your bot, fetch user profile, get si ms.topic: conceptual ms.localizationpriority: high ms.owner: angovil -ms.date: 04/06/2026 +ms.date: 04/09/2026 --- # Get Teams specific context for your bot @@ -14,7 +14,7 @@ A bot can access additional context data about a team or chat where it's install Your bot can query for the list of members and their basic user profiles, including Teams user IDs and Microsoft Entra information, such as name and objectId. You can use this information to correlate user identities. For example, to check whether a user logged into a tab through Microsoft Entra credentials is a member of the team. -The following sample code is used for fetching the roster: +The following sample code is used to fetch the roster: # [C#](#tab/dotnet) @@ -26,7 +26,7 @@ app.OnMessage(async context => var conversationId = context.Activity.Conversation.Id; // Gets all members of the conversation. - var members = await context.Api.Conversations.Members.GetAsync(conversationId); + var members = await context.Api.Conversations.Members.Get(context.Conversation.Id); }); ``` @@ -53,7 +53,7 @@ async def handle_message(ctx: ActivityContext[MessageActivity]): conversation_id = ctx.activity.conversation.id # Gets all members of the conversation. - members = await ctx.api.conversations.members(conversation_id).get_all() + members = await ctx.api.conversations.members.get(ctx.activity.conversation.id) ``` # [JSON](#tab/json) @@ -147,7 +147,7 @@ async def handle_message(ctx: ActivityContext[MessageActivity]): member_id = ctx.activity.from_.id # Gets a single member by ID. - member = await ctx.api.conversations.members(conversation_id).get(member_id) + member = await ctx.api.conversations.members.get_by_id(conversation_id, member_id) ``` # [JSON](#tab/json)