名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
ユーザーのチームワークで新しいセクションを作成します。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
❌ |
❌ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
TeamworkSection.ReadWrite |
注意事項なし。 |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
| アプリケーション |
TeamworkSection.ReadWrite.All |
注意事項なし。 |
HTTP 要求
POST /users/{user-id}/teamwork/sections
| ヘッダー |
値 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
| Content-Type |
application/json. Required. |
| If-Match |
セクションを一覧表示するときに返される@microsoft.graph.sectionsVersion 注釈の値、または以前に取得したセクションの@odata.etag 値。 オプティミスティック コンカレンシー制御に必要です。 |
要求本文
要求本文で、 teamworkSection オブジェクトの JSON 表現を指定します。
次の表に、 teamworkSection を作成するときに設定できるプロパティの一覧を示します。
| プロパティ |
型 |
説明 |
| displayIcon |
sectionDisplayIcon |
セクションに表示されるアイコン。 省略可能。 アイコンの skinTone プロパティは設定できません。また、ユーザー設定から派生しています。 |
| displayName |
文字列 |
セクションの表示名。 必須です。 最大長は 50 文字です。 表示名では大文字と小文字が区別され、ユーザーのセクション内で一意である必要があります。 次の名前はシステム定義セクション用に予約されており、使用できません: RecentChats、 QuickViews、 TeamsAndChannels、 MutedChats、 MeetingChats、 EngageCommunities。 |
| isExpanded |
ブール型 |
ユーザー インターフェイスでセクションが展開されているかどうかを示します。 省略可能。 既定値は true です。 |
| sortType |
sectionSortType |
セクション内の項目の並べ替え順序。 省略可能。 既定値は userDefinedCustomOrder です。 ユーザー定義セクションの有効な値は、 mostRecent、 unreadThenMostRecent、 userDefinedCustomOrder、 unknownFutureValueです。
nameAlphabetical メンバーは、ユーザー定義セクションでは有効ではありません。 |
応答
成功した場合、このメソッドは応答コード 201 Created と、応答本文に teamworkSection オブジェクトを返します。
注:
応答には、更新された @odata.etag 値が 含まれます。 この値は、後続の変更操作の If-Match ヘッダーとして使用します。
次のエラーが発生する可能性があります。
| 応答コード |
メッセージ |
400 Bad Request |
'displayName' プロパティは必須であり、空にすることはできません。 |
400 Bad Request |
'displayName' プロパティは 50 文字以内で指定してください。 |
400 Bad Request |
セクション表示名に無効な文字または形式が含まれています。 |
400 Bad Request |
'id'、'createdDateTime'、'lastModifiedDateTime'、'sectionType'、または 'isHierarchicalViewEnabled' プロパティは読み取り専用であり、セクションの作成時に指定することはできません。 |
400 Bad Request |
'displayIcon.contentUrl' プロパティはサポートされていません。また、'displayIcon.displayName' または 'displayIcon.skinTone' プロパティは読み取り専用であり、指定しないでください。 |
400 Bad Request |
セクションの最大数に達しました。 |
409 Conflict |
この表示名のセクションは既に存在します。 要求された displayName が、既存のユーザー定義セクションまたは予約済みのシステム定義セクション名 (RecentChats、 QuickViews、 TeamsAndChannels、 MutedChats、 MeetingChats、 EngageCommunities) と一致すると返されます。 比較では大文字と小文字が区別されます。 |
412 Precondition Failed |
If-Match ヘッダー値が現在のセクション階層バージョンと一致しません。
セクションをもう一度一覧表示 して 、現在の@microsoft.graph.sectionsVersion 注釈を 取得し、再試行します。 |
428 Precondition Required |
この操作には、 If-Match ヘッダーが必要です。 |
例
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/users/10f8c3a6-3e2a-4e8b-9c7d-5a4b6c8d9e0f/teamwork/sections
Content-type: application/json
If-Match: "1742515200"
{
"displayName": "Project Alpha",
"displayIcon": {
"iconType": "🚀"
},
"sortType": "mostRecent"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new TeamworkSection
{
DisplayName = "Project Alpha",
DisplayIcon = new SectionDisplayIcon
{
IconType = "🚀",
},
SortType = SectionSortType.MostRecent,
};
// 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.PostAsync(requestBody, (requestConfiguration) =>
{
requestConfiguration.Headers.Add("If-Match", "\"1742515200\"");
});
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("If-Match", "\"1742515200\"")
configuration := &graphusers.ItemTeamworkSectionsRequestBuilderPostRequestConfiguration{
Headers: headers,
}
requestBody := graphmodels.NewTeamworkSection()
displayName := "Project Alpha"
requestBody.SetDisplayName(&displayName)
displayIcon := graphmodels.NewSectionDisplayIcon()
iconType := "🚀"
displayIcon.SetIconType(&iconType)
requestBody.SetDisplayIcon(displayIcon)
sortType := graphmodels.MOSTRECENT_SECTIONSORTTYPE
requestBody.SetSortType(&sortType)
// 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().Post(context.Background(), requestBody, configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TeamworkSection teamworkSection = new TeamworkSection();
teamworkSection.setDisplayName("Project Alpha");
SectionDisplayIcon displayIcon = new SectionDisplayIcon();
displayIcon.setIconType("🚀");
teamworkSection.setDisplayIcon(displayIcon);
teamworkSection.setSortType(SectionSortType.MostRecent);
TeamworkSection result = graphClient.users().byUserId("{user-id}").teamwork().sections().post(teamworkSection, requestConfiguration -> {
requestConfiguration.headers.add("If-Match", "\"1742515200\"");
});
const options = {
authProvider,
};
const client = Client.init(options);
const teamworkSection = {
displayName: 'Project Alpha',
displayIcon: {
iconType: '🚀'
},
sortType: 'mostRecent'
};
await client.api('/users/10f8c3a6-3e2a-4e8b-9c7d-5a4b6c8d9e0f/teamwork/sections')
.version('beta')
.post(teamworkSection);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\Teamwork\Sections\SectionsRequestBuilderPostRequestConfiguration;
use Microsoft\Graph\Beta\Generated\Models\TeamworkSection;
use Microsoft\Graph\Beta\Generated\Models\SectionDisplayIcon;
use Microsoft\Graph\Beta\Generated\Models\SectionSortType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TeamworkSection();
$requestBody->setDisplayName('Project Alpha');
$displayIcon = new SectionDisplayIcon();
$displayIcon->setIconType('🚀');
$requestBody->setDisplayIcon($displayIcon);
$requestBody->setSortType(new SectionSortType('mostRecent'));
$requestConfiguration = new SectionsRequestBuilderPostRequestConfiguration();
$headers = [
'If-Match' => '"1742515200"',
];
$requestConfiguration->headers = $headers;
$result = $graphServiceClient->users()->byUserId('user-id')->teamwork()->sections()->post($requestBody, $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.sections_request_builder import SectionsRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from msgraph_beta.generated.models.teamwork_section import TeamworkSection
from msgraph_beta.generated.models.section_display_icon import SectionDisplayIcon
from msgraph_beta.generated.models.section_sort_type import SectionSortType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = TeamworkSection(
display_name = "Project Alpha",
display_icon = SectionDisplayIcon(
icon_type = "🚀",
),
sort_type = SectionSortType.MostRecent,
)
request_configuration = RequestConfiguration()
request_configuration.headers.add("If-Match", "\"1742515200\"")
result = await graph_client.users.by_user_id('user-id').teamwork.sections.post(request_body, request_configuration = request_configuration)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json
Location: https://graph.microsoft.com/beta/users/10f8c3a6-3e2a-4e8b-9c7d-5a4b6c8d9e0f/teamwork/sections/c3d4e5f6-a7b8-9012-cdef-123456789012
{
"@odata.type": "#microsoft.graph.teamworkSection",
"@odata.etag": "\"1742515210\"",
"id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"displayName": "Project Alpha",
"displayIcon": {
"iconType": "🚀",
"displayName": "Rocket",
"contentUrl": null,
"skinTone": null
},
"sectionType": "userDefined",
"sortType": "mostRecent",
"isExpanded": true,
"isHierarchicalViewEnabled": false,
"createdDateTime": "2026-03-08T10:00:00Z",
"lastModifiedDateTime": "2026-03-08T10:00:00Z"
}