命名空间:microsoft.graph
重要
Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
读取用户团队合作中某个部分的属性。
此 API 可用于以下国家级云部署。
| 全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
| ✅ |
❌ |
❌ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
| 权限类型 |
最低特权权限 |
更高特权权限 |
| 委派(工作或学校帐户) |
Teamworksection.Read |
TeamworkSection.ReadWrite |
| 委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
| 应用程序 |
Teamworksection.Read.All |
TeamworkSection.ReadWrite.All |
HTTP 请求
GET /users/{user-id}/teamwork/sections/{teamworkSection-id}
可选的查询参数
此方法支持 $expand OData 查询参数来帮助自定义响应。 只能扩展 项 关系,并且仅支持一个级别的扩展。 有关详细信息,请参阅 OData 查询参数。
指定 时 $expand=items ,响应将在 节中包含 内联项 集合:
- 对于 用户定义的部分, 项目 集合包含分区内组织的聊天、频道、会议和社区。
- 对于 系统定义的节, items 集合始终以空数组的形式返回, (
[]) 。 系统定义的节内容不会通过公共图形 API公开。
| 标头 |
值 |
| Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
| If-None-Match |
列出节时返回的 @microsoft.graph.sectionsVersion 注释的值,或以前检索到的任何节中的 @odata.etag 值。 如果节层次结构未更改,此标头将 304 Not Modified 返回响应代码。 可选。 |
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在 200 OK 响应正文中返回响应代码和 teamworkSection 对象。
If-None-Match如果提供了标头,但资源未更改,则此方法将返回304 Not Modified响应。
示例
示例 1:获取节
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/users/10f8c3a6-3e2a-4e8b-9c7d-5a4b6c8d9e0f/teamwork/sections/a1b2c3d4-e5f6-7890-abcd-ef1234567890
// 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.Users["{user-id}"].Teamwork.Sections["{teamworkSection-id}"].GetAsync();
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
sections, err := graphClient.Users().ByUserId("user-id").Teamwork().Sections().ByTeamworkSectionId("teamworkSection-id").Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TeamworkSection result = graphClient.users().byUserId("{user-id}").teamwork().sections().byTeamworkSectionId("{teamworkSection-id}").get();
const options = {
authProvider,
};
const client = Client.init(options);
let teamworkSection = await client.api('/users/10f8c3a6-3e2a-4e8b-9c7d-5a4b6c8d9e0f/teamwork/sections/a1b2c3d4-e5f6-7890-abcd-ef1234567890')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->users()->byUserId('user-id')->teamwork()->sections()->byTeamworkSectionId('teamworkSection-id')->get()->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.users.by_user_id('user-id').teamwork.sections.by_teamwork_section_id('teamworkSection-id').get()
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
ETag: "1742515200"
{
"@odata.type": "#microsoft.graph.teamworkSection",
"@odata.etag": "\"1742515200\"",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"displayName": "Favorites",
"displayIcon": {
"iconType": "⭐",
"displayName": "Star",
"contentUrl": null,
"skinTone": null
},
"sectionType": "userDefined",
"sortType": "mostRecent",
"isExpanded": true,
"isHierarchicalViewEnabled": false,
"createdDateTime": "2025-01-15T10:30:00Z",
"lastModifiedDateTime": "2025-03-01T14:22:00Z"
}
示例 2:获取已展开项的用户定义节
以下示例使用 $expand=items 在单个请求中返回 节及其 items 集合。
请求
GET https://graph.microsoft.com/beta/users/10f8c3a6-3e2a-4e8b-9c7d-5a4b6c8d9e0f/teamwork/sections/a1b2c3d4-e5f6-7890-abcd-ef1234567890?$expand=items
// 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.Users["{user-id}"].Teamwork.Sections["{teamworkSection-id}"].GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string []{ "items" };
});
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
//other-imports
)
requestParameters := &graphusers.ItemTeamworkSectionsItemRequestBuilderGetQueryParameters{
Expand: [] string {"items"},
}
configuration := &graphusers.ItemTeamworkSectionsItemRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
sections, err := graphClient.Users().ByUserId("user-id").Teamwork().Sections().ByTeamworkSectionId("teamworkSection-id").Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TeamworkSection result = graphClient.users().byUserId("{user-id}").teamwork().sections().byTeamworkSectionId("{teamworkSection-id}").get(requestConfiguration -> {
requestConfiguration.queryParameters.expand = new String []{"items"};
});
const options = {
authProvider,
};
const client = Client.init(options);
let teamworkSection = await client.api('/users/10f8c3a6-3e2a-4e8b-9c7d-5a4b6c8d9e0f/teamwork/sections/a1b2c3d4-e5f6-7890-abcd-ef1234567890')
.version('beta')
.expand('items')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\Teamwork\Sections\Item\TeamworkSectionItemRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new TeamworkSectionItemRequestBuilderGetRequestConfiguration();
$queryParameters = TeamworkSectionItemRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->expand = ["items"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->users()->byUserId('user-id')->teamwork()->sections()->byTeamworkSectionId('teamworkSection-id')->get($requestConfiguration)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.users.item.teamwork.sections.item.teamwork_section_item_request_builder import TeamworkSectionItemRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = TeamworkSectionItemRequestBuilder.TeamworkSectionItemRequestBuilderGetQueryParameters(
expand = ["items"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.users.by_user_id('user-id').teamwork.sections.by_teamwork_section_id('teamworkSection-id').get(request_configuration = request_configuration)
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
ETag: "1742515200"
{
"@odata.type": "#microsoft.graph.teamworkSection",
"@odata.etag": "\"1742515200\"",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"displayName": "Favorites",
"sectionType": "userDefined",
"sortType": "mostRecent",
"isExpanded": true,
"isHierarchicalViewEnabled": false,
"createdDateTime": "2025-01-15T10:30:00Z",
"lastModifiedDateTime": "2025-03-01T14:22:00Z",
"items": [
{
"@odata.type": "#microsoft.graph.teamworkSectionItem",
"id": "19:d5b2c3a4-e6f7-8901-abcd-ef3456789012@thread.v2",
"itemType": "chat",
"createdDateTime": "2025-02-10T09:15:00Z",
"lastModifiedDateTime": "2025-03-05T11:30:00Z"
},
{
"@odata.type": "#microsoft.graph.teamworkSectionItem",
"id": "19:e6f7a8b9-0123-4567-89ab-cdef01234567@thread.tacv2",
"itemType": "channel",
"createdDateTime": "2025-01-20T14:00:00Z",
"lastModifiedDateTime": "2025-03-01T08:45:00Z"
}
]
}
示例 3:获取已展开项的系统定义节
以下示例在系统定义的节上使用 $expand=items 。
items 集合以空数组的形式返回,因为系统定义的节内容不会通过公共图形 API公开。
请求
GET https://graph.microsoft.com/beta/users/10f8c3a6-3e2a-4e8b-9c7d-5a4b6c8d9e0f/teamwork/sections/b2c3d4e5-f6a7-8901-bcde-f12345678901?$expand=items
// 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.Users["{user-id}"].Teamwork.Sections["{teamworkSection-id}"].GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string []{ "items" };
});
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
//other-imports
)
requestParameters := &graphusers.ItemTeamworkSectionsItemRequestBuilderGetQueryParameters{
Expand: [] string {"items"},
}
configuration := &graphusers.ItemTeamworkSectionsItemRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
sections, err := graphClient.Users().ByUserId("user-id").Teamwork().Sections().ByTeamworkSectionId("teamworkSection-id").Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TeamworkSection result = graphClient.users().byUserId("{user-id}").teamwork().sections().byTeamworkSectionId("{teamworkSection-id}").get(requestConfiguration -> {
requestConfiguration.queryParameters.expand = new String []{"items"};
});
const options = {
authProvider,
};
const client = Client.init(options);
let teamworkSection = await client.api('/users/10f8c3a6-3e2a-4e8b-9c7d-5a4b6c8d9e0f/teamwork/sections/b2c3d4e5-f6a7-8901-bcde-f12345678901')
.version('beta')
.expand('items')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\Teamwork\Sections\Item\TeamworkSectionItemRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new TeamworkSectionItemRequestBuilderGetRequestConfiguration();
$queryParameters = TeamworkSectionItemRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->expand = ["items"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->users()->byUserId('user-id')->teamwork()->sections()->byTeamworkSectionId('teamworkSection-id')->get($requestConfiguration)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.users.item.teamwork.sections.item.teamwork_section_item_request_builder import TeamworkSectionItemRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = TeamworkSectionItemRequestBuilder.TeamworkSectionItemRequestBuilderGetQueryParameters(
expand = ["items"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.users.by_user_id('user-id').teamwork.sections.by_teamwork_section_id('teamworkSection-id').get(request_configuration = request_configuration)
响应
HTTP/1.1 200 OK
Content-type: application/json
ETag: "1742515200"
{
"@odata.type": "#microsoft.graph.teamworkSection",
"@odata.etag": "\"1742515200\"",
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"displayName": "TeamsAndChannels",
"sectionType": "systemDefined",
"sortType": "nameAlphabetical",
"isExpanded": true,
"isHierarchicalViewEnabled": true,
"createdDateTime": "2024-06-10T08:00:00Z",
"lastModifiedDateTime": "2025-02-28T16:45:00Z",
"items": []
}