名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
特定の ディレクトリ設定 オブジェクトのプロパティを更新します。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
✅ |
✅ |
✅ |
アクセス許可
次の表は、サポートされている各リソースの種類でこの API を呼び出すために必要な最小特権のアクセス許可またはアクセス許可を示しています。
ベスト プラクティスに従って、最小限の特権のアクセス許可を要求します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
同意ポリシー設定オブジェクト を除く すべての設定
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
Directory.ReadWrite.All |
注意事項なし。 |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
Directory.ReadWrite.All |
注意事項なし。 |
重要
職場または学校アカウントを使用した委任されたシナリオでは、サインインしているユーザーに、サポートされているMicrosoft Entraロールまたはサポートされているロールのアクセス許可を持つカスタム ロールを割り当てる必要があります。 この操作では、次の最小特権ロールがサポートされています。
- テンプレートと設定の設定に関する基本的なプロパティの読み取り - Microsoft Entra参加済みデバイス ローカル管理者、ディレクトリ リーダー、グローバル リーダー
- すべてのグループ/ディレクトリ設定を管理する - ディレクトリ ライター
- グループのグローバル設定とローカル設定を管理する。
Group.Unified.Guest
と Group.Unified
の設定を管理する - グループ管理者
-
Password Rule Settings
の更新 - 認証ポリシー管理者
- 設定の更新、テンプレートと設定の設定に関する基本的なプロパティの読み取り - ユーザー管理者
同意ポリシー設定オブジェクトの場合
"同意ポリシー設定" directorySetting オブジェクトを更新するには、次のアクセス許可が必要です。
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
Policy.ReadWrite.Authorization |
Directory.ReadWrite.All |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
Policy.ReadWrite.Authorization |
Directory.ReadWrite.All |
HTTP 要求
テナント全体の設定を更新します。
PATCH /settings/{directorySettingId}
グループ固有の設定を更新します。
PATCH /groups/{groupId}/settings/{directorySettingId}
名前 |
説明 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
要求本文
要求本文で、更新する関連フィールドの値を指定します。
プロパティ |
型 |
説明 |
values |
settingValue コレクション |
更新された値のセット。 注: コレクション セット全体を指定する必要があります。 1 つの値セットを更新することはできません。 |
応答
成功した場合、このメソッドは 204 No Content
応答コードを返します。
例
要求
次の例は要求を示しています。
PATCH https://graph.microsoft.com/beta/settings/3c105fc3-2254-4861-9e2d-d59e2126f3ef
Content-type: application/json
{
"values": [
{
"name": "CustomBlockedWordsList",
"value": "Contoso"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new DirectorySetting
{
Values = new List<SettingValue>
{
new SettingValue
{
Name = "CustomBlockedWordsList",
Value = "Contoso",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Settings["{directorySetting-id}"].PatchAsync(requestBody);
mgc-beta settings patch --directory-setting-id {directorySetting-id} --body '{\
"values": [\
{\
"name": "CustomBlockedWordsList",\
"value": "Contoso"\
}\
]\
}\
'
// 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.NewDirectorySetting()
settingValue := graphmodels.NewSettingValue()
name := "CustomBlockedWordsList"
settingValue.SetName(&name)
value := "Contoso"
settingValue.SetValue(&value)
values := []graphmodels.SettingValueable {
settingValue,
}
requestBody.SetValues(values)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
settings, err := graphClient.Settings().ByDirectorySettingId("directorySetting-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);
DirectorySetting directorySetting = new DirectorySetting();
LinkedList<SettingValue> values = new LinkedList<SettingValue>();
SettingValue settingValue = new SettingValue();
settingValue.setName("CustomBlockedWordsList");
settingValue.setValue("Contoso");
values.add(settingValue);
directorySetting.setValues(values);
DirectorySetting result = graphClient.settings().byDirectorySettingId("{directorySetting-id}").patch(directorySetting);
const options = {
authProvider,
};
const client = Client.init(options);
const directorySetting = {
values: [
{
name: 'CustomBlockedWordsList',
value: 'Contoso'
}
]
};
await client.api('/settings/3c105fc3-2254-4861-9e2d-d59e2126f3ef')
.version('beta')
.update(directorySetting);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\DirectorySetting;
use Microsoft\Graph\Beta\Generated\Models\SettingValue;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DirectorySetting();
$valuesSettingValue1 = new SettingValue();
$valuesSettingValue1->setName('CustomBlockedWordsList');
$valuesSettingValue1->setValue('Contoso');
$valuesArray []= $valuesSettingValue1;
$requestBody->setValues($valuesArray);
$result = $graphServiceClient->settings()->byDirectorySettingId('directorySetting-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
$params = @{
values = @(
@{
name = "CustomBlockedWordsList"
value = "Contoso"
}
)
}
Update-MgBetaDirectorySetting -DirectorySettingId $directorySettingId -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.directory_setting import DirectorySetting
from msgraph_beta.generated.models.setting_value import SettingValue
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DirectorySetting(
values = [
SettingValue(
name = "CustomBlockedWordsList",
value = "Contoso",
),
],
)
result = await graph_client.settings.by_directory_setting_id('directorySetting-id').patch(request_body)
応答
HTTP/1.1 204 No Content