Skip to content

Commit b476d30

Browse files
committed
Update get-teams-context.md
1 parent cf9dd7f commit b476d30

1 file changed

Lines changed: 4 additions & 22 deletions

File tree

msteams-platform/bots/how-to/get-teams-context.md

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ description: Get Teams specific context for your bot, fetch user profile, get si
44
ms.topic: conceptual
55
ms.localizationpriority: high
66
ms.owner: angovil
7-
ms.date: 03/24/2026
7+
ms.date: 03/25/2026
88
---
99
# Get Teams specific context for your bot
1010

11-
[!INCLUDE [pre-release-label](~/includes/v4-to-v3-pointer-bots.md)]
12-
1311
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.
1412

1513
## Fetch the roster or user profile
@@ -27,8 +25,6 @@ The following sample code uses the paged endpoint for fetching the roster:
2725

2826
* [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getpagedmembersasync?view=botbuilder-dotnet-stable&preserve-view=true)
2927

30-
* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/graph-proactive-installation/csharp/ProactiveAppInstallation/Bots/ProactiveBot.cs#L78)
31-
3228
```csharp
3329
app.OnMessage(async context =>
3430
{
@@ -43,8 +39,6 @@ app.OnMessage(async context =>
4339

4440
* [SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getpagedmembers)
4541

46-
* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/graph-proactive-installation/nodejs/bots/proactiveBot.js#L38)
47-
4842
```typescript
4943
app.on('message', async ({ activity, api }) => {
5044
const conversationId = activity.conversation.id;
@@ -110,7 +104,7 @@ Response body
110104

111105
* * *
112106

113-
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.
107+
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.
114108

115109
## Get single member details
116110

@@ -122,8 +116,6 @@ The following sample code is used to get single member details:
122116

123117
* [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getmemberasync?view=botbuilder-dotnet-stable&preserve-view=true)
124118

125-
* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-sequential-flow-adaptive-cards/csharp/SequentialUserSpecificFlow/Bots/UserSpecificBot.cs#L37)
126-
127119
```csharp
128120
app.OnMessage(async context =>
129121
{
@@ -139,8 +131,6 @@ app.OnMessage(async context =>
139131

140132
* [SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getmember)
141133

142-
* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-conversation/nodejs/bots/teamsConversationBot.js#L186)
143-
144134
```typescript
145135
app.on('message', async ({ activity, api }) => {
146136
const conversationId = activity.conversation.id;
@@ -155,8 +145,6 @@ app.on('message', async ({ activity, api }) => {
155145

156146
* [SDK reference](/python/api/botbuilder-core/botbuilder.core.teams.teamsinfo?view=botbuilder-py-latest&preserve-view=true#botbuilder-core-teams-teamsinfo-get-member)
157147

158-
* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-conversation/python/bots/teams_conversation_bot.py#L67)
159-
160148
```python
161149
@app.on_message
162150
async def handle_message(ctx: ActivityContext[MessageActivity]):
@@ -205,7 +193,7 @@ Response body
205193

206194
* * *
207195

208-
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.
196+
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.
209197

210198
## Get team's details
211199

@@ -217,8 +205,6 @@ The following sample code is used to get team's details:
217205

218206
* [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getteamdetailsasync?view=botbuilder-dotnet-stable&preserve-view=true)
219207

220-
* [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)
221-
222208
```csharp
223209
app.OnMessage(async context =>
224210
{
@@ -241,8 +227,6 @@ app.OnMessage(async context =>
241227

242228
* [SDK reference](/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest&preserve-view=true#botbuilder-teamsinfo-getteamdetails)
243229

244-
* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/app-complete-sample/nodejs/server/dialogs/teams/fetchTeamInfoDialog.js#L21)
245-
246230
```typescript
247231
app.on('message', async ({ activity, api, send }) => {
248232
const teamId = activity.channelData?.team?.id;
@@ -291,7 +275,7 @@ Response body
291275

292276
* * *
293277

294-
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.
278+
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.
295279

296280
## Get the list of channels in a team
297281

@@ -308,8 +292,6 @@ The following sample code is used to get the list of channels in a team:
308292

309293
* [SDK reference](/dotnet/api/microsoft.bot.builder.teams.teamsinfo.getteamchannelsasync?view=botbuilder-dotnet-stable&preserve-view=true)
310294

311-
* [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)
312-
313295
```csharp
314296
app.OnMessage(async context =>
315297
{

0 commit comments

Comments
 (0)