名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
グループ オブジェクトのプロパティを更新します。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
Group.ReadWrite.All |
Directory.ReadWrite.All |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
| アプリケーション |
Group.ReadWrite.All |
Directory.ReadWrite.All |
HTTP 要求
PATCH /groups/{id}
| 名前 |
型 |
説明 |
| Authorization |
string |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
要求本文
要求本文で、更新すべきプロパティの値のみを指定します。 要求本文に含まれない既存のプロパティは、以前の値のままになるか、他のプロパティ値の変化に基づいて再計算されます。
次の表に、更新できるプロパティを示します。
| プロパティ |
型 |
説明 |
| allowExternalSenders |
Boolean |
既定値は false です。 組織外部のユーザーがグループにメッセージを送信できるかどうかを示します。 |
| assignedLabels |
assignedLabel コレクション |
Microsoft 365 グループに関連付けられている秘密度ラベル ペア (ラベル ID、ラベル名) のリスト。 このプロパティは、呼び出し元が Microsoft Graph のアクセス許可と サポートされている管理者ロールの両方を必要とする委任されたシナリオでのみ更新できます。 |
| autoSubscribeNewMembers |
Boolean |
既定値は false です。 グループに追加された新しいメンバーが、電子メールの通知を受信するように自動的にサブスクライブされるかどうかを示します。 グループで subscriptionEnabled が false に設定されている場合、autoSubscribeNewMembers は true になることができません。 |
| 説明 |
String |
グループに関するオプションの説明。 |
| displayName |
文字列 |
グループの表示名。 このプロパティは、グループの作成時の必須プロパティであり、更新時にクリアすることはできません。 |
| mailNickname |
String |
組織内の Microsoft 365 グループに対して一意の、グループのメール エイリアス。 最大文字数は 64 文字です。 このプロパティには、 ASCII 文字セット 0 ~ 127 の文字のみを含めることができます。ただし、以下の @ () \ [] " ; : . <> , SPACEを除いたものです。 |
| preferredDataLocation |
String |
Microsoft 365 グループのデータの優先される場所。 このプロパティを更新するには、呼び出し元のユーザーに、次のMicrosoft Entraロールの少なくとも 1 つを割り当てる必要があります。
- ユーザー アカウント管理者
- ディレクトリ ライター
- Exchange 管理者
- SharePoint 管理者
このプロパティの詳細については、「OneDrive Online Multi-Geo」 を参照してください。 |
| securityEnabled |
ブール値 |
グループがセキュリティ グループ (Microsoft 365 グループを含む) であるかどうかを指定します。 |
| uniqueName |
String |
グループに割り当て、代替キーとして使用できる一意の識別子。
nullし、一度設定すると変更できない場合にのみ更新できます。 |
| visibility |
String |
Microsoft 365 グループの表示を指定します。 可能な値は以下のどれかです: Private、Publicまたは empty (これは Publicと解釈されます)。 |
| writebackConfiguration |
groupWritebackConfiguration |
グループ オブジェクトのプロパティをオンプレミスの Active Directory に書き戻すようにグループを構成するかどうかを指定します。 これらのプロパティは、Microsoft Entra Connect 同期クライアントでグループ ライトバックが構成されている場合に使用されます。 |
重要
- これらのプロパティ (allowExternalSenders、 autoSubscribeNewMembers、 hideFromAddressLists、 hideFromOutlookClients、 isSubscribedByMail、 unseenCount) を更新するには、次の手順を実行する必要があります。
- 前の表の他のプロパティを含めずに、それらを独自の PATCH 要求で指定します
- Group.ReadWrite.All アクセス許可を持つ (Directory.ReadWrite.All はこれらのプロパティではサポートされていません)
- コア グループの管理と管理に関連するグループ API のサブセットのみが、アプリケーションと委任されたアクセス許可をサポートします。
autoSubscribeNewMembers の更新など、グループ API の他のすべてのメンバーは、委任されたアクセス許可のみをサポートします。
- Microsoft Exchange Server でメールが有効なセキュリティ グループを更新するためのルールが複雑になる場合があります。詳細については、「Exchange Server でメールが有効なセキュリティ グループを管理する」を参照してください。
- assignedLabels を更新する場合、アプリケーションのアクセス許可はサポートされません。
拡張機能と関連データを管理する
次のように、この API を使用して、ディレクトリ、スキーマ、およびユーザーのオープン拡張機能 とそのデータを管理します。
- 既存のユーザーの拡張機能にデータを追加、更新、および格納します。
- ディレクトリおよびスキーマ拡張機能の場合は、カスタム拡張プロパティの値を
null に設定して、格納されているデータをすべて削除します。 オープン拡張機能の場合は、[オープン拡張機能を削除する] API を使用します。
応答
成功した場合は、 このメソッドは 204 No Content 応答コードを返します。ただし、次のプロパティを更新する場合は、200 OK 応答コードを除きます: allowExternalSenders、autoSubscribeNewMembers、hideFromAddressLists、 hideFromOutlookClients、 isSubscribedByMail、unseenCount。
例
例 1: グループの表示名と説明を更新する
要求
次の例は要求を示しています。
PATCH https://graph.microsoft.com/beta/groups/0d09007d-45b2-458c-b180-880dde3a302e
Content-type: application/json
{
"description":"Contoso Life v2.0",
"displayName":"Contoso Life Renewed"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Group
{
Description = "Contoso Life v2.0",
DisplayName = "Contoso Life Renewed",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Groups["{group-id}"].PatchAsync(requestBody);
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewGroup()
description := "Contoso Life v2.0"
requestBody.SetDescription(&description)
displayName := "Contoso Life Renewed"
requestBody.SetDisplayName(&displayName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
groups, err := graphClient.Groups().ByGroupId("group-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Group group = new Group();
group.setDescription("Contoso Life v2.0");
group.setDisplayName("Contoso Life Renewed");
Group result = graphClient.groups().byGroupId("{group-id}").patch(group);
const options = {
authProvider,
};
const client = Client.init(options);
const group = {
description: 'Contoso Life v2.0',
displayName: 'Contoso Life Renewed'
};
await client.api('/groups/0d09007d-45b2-458c-b180-880dde3a302e')
.version('beta')
.update(group);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Group;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Group();
$requestBody->setDescription('Contoso Life v2.0');
$requestBody->setDisplayName('Contoso Life Renewed');
$result = $graphServiceClient->groups()->byGroupId('group-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Groups
$params = @{
description = "Contoso Life v2.0"
displayName = "Contoso Life Renewed"
}
Update-MgBetaGroup -GroupId $groupId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.group import Group
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Group(
description = "Contoso Life v2.0",
display_name = "Contoso Life Renewed",
)
result = await graph_client.groups.by_group_id('group-id').patch(request_body)
応答
次の例は応答を示しています。
HTTP/1.1 204 No Content
例 2: Microsoft 365 グループに秘密度ラベルを適用する
要求
リスト ラベルを使用して、Microsoft 365 グループに適用する ラベルの ID を取得できます。 次に、グループの assignedLabels プロパティをラベル ID で更新できます。
手記: この API を使用して Microsoft 365 グループに秘密度ラベルを適用することは、委任されたアクセス許可シナリオでのみサポートされます。
PATCH https://graph.microsoft.com/beta/groups/{id}
Content-type: application/json
{
"assignedLabels":
[
{
"labelId" : "45cd0c48-c540-4358-ad79-a3658cdc5b88"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Group
{
AssignedLabels = new List<AssignedLabel>
{
new AssignedLabel
{
LabelId = "45cd0c48-c540-4358-ad79-a3658cdc5b88",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Groups["{group-id}"].PatchAsync(requestBody);
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewGroup()
assignedLabel := graphmodels.NewAssignedLabel()
labelId := "45cd0c48-c540-4358-ad79-a3658cdc5b88"
assignedLabel.SetLabelId(&labelId)
assignedLabels := []graphmodels.AssignedLabelable {
assignedLabel,
}
requestBody.SetAssignedLabels(assignedLabels)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
groups, err := graphClient.Groups().ByGroupId("group-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Group group = new Group();
LinkedList<AssignedLabel> assignedLabels = new LinkedList<AssignedLabel>();
AssignedLabel assignedLabel = new AssignedLabel();
assignedLabel.setLabelId("45cd0c48-c540-4358-ad79-a3658cdc5b88");
assignedLabels.add(assignedLabel);
group.setAssignedLabels(assignedLabels);
Group result = graphClient.groups().byGroupId("{group-id}").patch(group);
const options = {
authProvider,
};
const client = Client.init(options);
const group = {
assignedLabels:
[
{
labelId: '45cd0c48-c540-4358-ad79-a3658cdc5b88'
}
]
};
await client.api('/groups/{id}')
.version('beta')
.update(group);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Group;
use Microsoft\Graph\Beta\Generated\Models\AssignedLabel;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Group();
$assignedLabelsAssignedLabel1 = new AssignedLabel();
$assignedLabelsAssignedLabel1->setLabelId('45cd0c48-c540-4358-ad79-a3658cdc5b88');
$assignedLabelsArray []= $assignedLabelsAssignedLabel1;
$requestBody->setAssignedLabels($assignedLabelsArray);
$result = $graphServiceClient->groups()->byGroupId('group-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Groups
$params = @{
assignedLabels = @(
@{
labelId = "45cd0c48-c540-4358-ad79-a3658cdc5b88"
}
)
}
Update-MgBetaGroup -GroupId $groupId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.group import Group
from msgraph_beta.generated.models.assigned_label import AssignedLabel
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Group(
assigned_labels = [
AssignedLabel(
label_id = "45cd0c48-c540-4358-ad79-a3658cdc5b88",
),
],
)
result = await graph_client.groups.by_group_id('group-id').patch(request_body)
応答
次の例は応答を示しています。
HTTP/1.1 204 No Content
関連コンテンツ