在聊天中列出选项卡
本文内容
命名空间:microsoft.graph
检索指定聊天 中的选项卡 列表。
注意 :如果聊天与 onlineMeeting 实例相关联,则实际上会列出会议中固定的选项卡。
此 API 可用于以下国家级云部署 。
全局服务
美国政府 L4
美国政府 L5 (DOD)
由世纪互联运营的中国
✅
✅
✅
✅
权限
为此 API 选择标记为最低特权的权限。 只有在应用需要它时 ,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型 。 要了解有关这些权限的详细信息,请参阅 权限参考 。
权限类型
最低特权权限
更高特权权限
委派(工作或学校帐户)
TeamsTab.Read.All
TeamsTab.ReadWrite.All、TeamsTab.ReadWriteForChat、TeamsTab.ReadWriteSelfForChat
委派(个人 Microsoft 帐户)
不支持。
不支持。
应用程序
TeamsTab.Read.All
TeamsTab.ReadWrite.All、TeamsTab.ReadWriteForChat.All、TeamsTab.ReadWriteSelfForChat.All
HTTP 请求
GET /chats/{chat-id}/tabs
可选的查询参数
此方法支持 $filter
、 $select
和 $expand
OData 查询参数 ,以帮助自定义响应。
标头
值
Authorization
持有者 {token}。 必填。 详细了解 身份验证和授权 。
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回响应 200 OK
代码和 选项卡 对象的集合。
示例
示例 1:列出聊天中的所有选项卡以及关联的 Teams 应用
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/v1.0/chats/19:d65713bc498c4a428c71ef9353e6ce20@thread.v2/tabs?$expand=teamsApp
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Chats["{chat-id}"].Tabs.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string []{ "teamsApp" };
});
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc chats tabs list --chat-id {chat-id} --expand "teamsApp"
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphchats "github.com/microsoftgraph/msgraph-sdk-go/chats"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestParameters := &graphchats.ChatItemTabsRequestBuilderGetQueryParameters{
Expand: [] string {"teamsApp"},
}
configuration := &graphchats.ChatItemTabsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
tabs, err := graphClient.Chats().ByChatId("chat-id").Tabs().Get(context.Background(), configuration)
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TeamsTabCollectionResponse result = graphClient.chats().byChatId("{chat-id}").tabs().get(requestConfiguration -> {
requestConfiguration.queryParameters.expand = new String []{"teamsApp"};
});
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
const options = {
authProvider,
};
const client = Client.init(options);
let tabs = await client.api('/chats/19:d65713bc498c4a428c71ef9353e6ce20@thread.v2/tabs')
.expand('teamsApp')
.get();
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Chats\Item\Tabs\TabsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new TabsRequestBuilderGetRequestConfiguration();
$queryParameters = TabsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->expand = ["teamsApp"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->chats()->byChatId('chat-id')->tabs()->get($requestConfiguration)->wait();
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
Import-Module Microsoft.Graph.Teams
Get-MgChatTab -ChatId $chatId -ExpandProperty "teamsApp"
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
from msgraph import GraphServiceClient
from msgraph.generated.chats.item.tabs.tabs_request_builder import TabsRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = TabsRequestBuilder.TabsRequestBuilderGetQueryParameters(
expand = ["teamsApp"],
)
request_configuration = TabsRequestBuilder.TabsRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.chats.by_chat_id('chat-id').tabs.get(request_configuration = request_configuration)
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
响应
以下示例显示了相应的响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 Success
Content-type: application/json
{
"value": [
{
"id": "794f0e4e-4d10-4bb5-9079-3a465a629eff",
"displayName": "My Contoso Tab - updated",
"sortOrderIndex": "20",
"webUrl": "https://teams.microsoft.com/l/entity/com.microsoft.teamspace.tab.web/_djb2_msteams_prefix_193fe248-24e6-478f-a66c-ede9ce6dd547?context=%7b%0d%0a++%22context%22%3a+%22chat%22%2c%0d%0a++%22chatId%22%3a+%2219%3ad65713bc498c4a428c71ef9353e6ce20%40thread.v2%22%2c%0d%0a++%22subEntityId%22%3a+null%0d%0a%7d&tenantId=139d16b4-7223-43ad-b9a8-674ba63c7924",
"configuration": {
"entityId": "2DCA2E6C7A10415CAF6B8AB6661B3154",
"contentUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154/tabView",
"websiteUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154",
"removeUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154/uninstallTab"
},
"teamsApp": {
"id": "06805b9e-77e3-4b93-ac81-525eb87513b8",
"displayName": "Contoso",
"distributionMethod": "store"
}
},
{
"id": "1f7b40e5-ecdf-40cb-b02e-e785cf71c0e9",
"displayName": "Website2",
"teamsAppId": null,
"sortOrderIndex": "10000100",
"messageId": "1607411851584",
"webUrl": "https://teams.microsoft.com/l/entity/com.microsoft.teamspace.tab.web/_djb2_msteams_prefix_44125e1d-04b1-421a-9f45-19d913494b3e?context=%7b%0d%0a++%22context%22%3a+%22chat%22%2c%0d%0a++%22chatId%22%3a+%2219%3ad65713bc498c4a428c71ef9353e6ce20%40thread.v2%22%2c%0d%0a++%22subEntityId%22%3a+null%0d%0a%7d&tenantId=139d16b4-7223-43ad-b9a8-674ba63c7924",
"configuration": {
"entityId": null,
"contentUrl": "https://www.bing.com",
"removeUrl": null,
"websiteUrl": "https://www.bing.com",
"dateAdded": "2020-12-08T07:17:29.748Z"
},
"teamsApp": {
"id": "com.microsoft.teamspace.tab.web",
"externalId": null,
"displayName": "Website",
"distributionMethod": "store"
}
},
{
"id": "b92dd123-1624-425c-a808-2f11e03534a5",
"displayName": "Some random board",
"sortOrderIndex": "10000100100",
"messageId": "1607412162267",
"webUrl": "https://teams.microsoft.com/l/entity/49e6f432-d79c-49e8-94f7-89b94f3672fd/_djb2_msteams_prefix_2919ec48-12d8-4533-b849-56c4d207734b?context=%7b%0d%0a++%22context%22%3a+%22chat%22%2c%0d%0a++%22chatId%22%3a+%2219%3ad65713bc498c4a428c71ef9353e6ce20%40thread.v2%22%2c%0d%0a++%22subEntityId%22%3a+null%0d%0a%7d&tenantId=139d16b4-7223-43ad-b9a8-674ba63c7924",
"configuration": {
"entityId": "5fcf29c17a3a3142160b8694",
"contentUrl": "https://trello.com/integrations/teams/tab-content?iframeSource=msteams&contentUrl=https%3A%2F%2Ftrello.com%2Fb%2FkS2FslqK%2Fsome-random-board",
"removeUrl": "https://trello.com/integrations/teams/tab-delete?iframeSource=msteams",
"websiteUrl": "https://trello.com/b/kS2FslqK/some-random-board",
"dateAdded": "2020-12-08T07:22:40.001Z"
},
"teamsApp": {
"id": "49e6f432-d79c-49e8-94f7-89b94f3672fd",
"externalId": null,
"displayName": "Trello",
"distributionMethod": "store"
}
}
]
}
示例 2:列出聊天中属于特定应用的所有选项卡
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/v1.0/chats/19:d65713bc498c4a428c71ef9353e6ce20@thread.v2/tabs?$expand=teamsApp&$filter=teamsApp/id eq 'com.microsoft.teamspace.tab.web'
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Chats["{chat-id}"].Tabs.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string []{ "teamsApp" };
requestConfiguration.QueryParameters.Filter = "teamsApp/id eq 'com.microsoft.teamspace.tab.web'";
});
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc chats tabs list --chat-id {chat-id} --filter "teamsApp/id eq 'com.microsoft.teamspace.tab.web'" --expand "teamsApp"
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphchats "github.com/microsoftgraph/msgraph-sdk-go/chats"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestFilter := "teamsApp/id eq 'com.microsoft.teamspace.tab.web'"
requestParameters := &graphchats.ChatItemTabsRequestBuilderGetQueryParameters{
Expand: [] string {"teamsApp"},
Filter: &requestFilter,
}
configuration := &graphchats.ChatItemTabsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
tabs, err := graphClient.Chats().ByChatId("chat-id").Tabs().Get(context.Background(), configuration)
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TeamsTabCollectionResponse result = graphClient.chats().byChatId("{chat-id}").tabs().get(requestConfiguration -> {
requestConfiguration.queryParameters.expand = new String []{"teamsApp"};
requestConfiguration.queryParameters.filter = "teamsApp/id eq 'com.microsoft.teamspace.tab.web'";
});
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
const options = {
authProvider,
};
const client = Client.init(options);
let tabs = await client.api('/chats/19:d65713bc498c4a428c71ef9353e6ce20@thread.v2/tabs')
.filter('teamsApp/id eq \'com.microsoft.teamspace.tab.web\'')
.expand('teamsApp')
.get();
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Chats\Item\Tabs\TabsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new TabsRequestBuilderGetRequestConfiguration();
$queryParameters = TabsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->expand = ["teamsApp"];
$queryParameters->filter = "teamsApp/id eq 'com.microsoft.teamspace.tab.web'";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->chats()->byChatId('chat-id')->tabs()->get($requestConfiguration)->wait();
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
Import-Module Microsoft.Graph.Teams
Get-MgChatTab -ChatId $chatId -ExpandProperty "teamsApp" -Filter "teamsApp/id eq 'com.microsoft.teamspace.tab.web'"
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
from msgraph import GraphServiceClient
from msgraph.generated.chats.item.tabs.tabs_request_builder import TabsRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = TabsRequestBuilder.TabsRequestBuilderGetQueryParameters(
expand = ["teamsApp"],
filter = "teamsApp/id eq 'com.microsoft.teamspace.tab.web'",
)
request_configuration = TabsRequestBuilder.TabsRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.chats.by_chat_id('chat-id').tabs.get(request_configuration = request_configuration)
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
响应
以下示例显示了相应的响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 Success
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#chats('19%3Ad65713bc498c4a428c71ef9353e6ce20%40thread.v2')/tabs(teamsApp())",
"@odata.count": 1,
"value": [
{
"id": "1f7b40e5-ecdf-40cb-b02e-e785cf71c0e9",
"displayName": "Website2",
"teamsAppId": null,
"sortOrderIndex": "10000100",
"messageId": "1607411851584",
"webUrl": "https://teams.microsoft.com/l/entity/com.microsoft.teamspace.tab.web/_djb2_msteams_prefix_44125e1d-04b1-421a-9f45-19d913494b3e?context=%7b%0d%0a++%22context%22%3a+%22chat%22%2c%0d%0a++%22chatId%22%3a+%2219%3ad65713bc498c4a428c71ef9353e6ce20%40thread.v2%22%2c%0d%0a++%22subEntityId%22%3a+null%0d%0a%7d&tenantId=139d16b4-7223-43ad-b9a8-674ba63c7924",
"configuration": {
"entityId": null,
"contentUrl": "https://www.bing.com",
"removeUrl": null,
"websiteUrl": "https://www.bing.com",
"dateAdded": "2020-12-08T07:17:29.748Z"
},
"teamsApp": {
"id": "com.microsoft.teamspace.tab.web",
"externalId": null,
"displayName": "Website",
"distributionMethod": "store"
}
}
]
}
相关内容