Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Créez un paramètre basé sur les modèles disponibles dans directorySettingTemplates. Ces paramètres peuvent être au niveau du locataire ou au niveau du groupe.
Les paramètres de groupe s’appliquent uniquement aux groupes Microsoft 365. Le modèle nommé Group.Unified peut être utilisé pour configurer les paramètres de groupe Microsoft 365 à l’échelle du locataire, tandis que le modèle nommé Group.Unified.Guest peut être utilisé pour configurer des paramètres spécifiques au groupe.
Dans les scénarios délégués avec des comptes professionnels ou scolaires, l’utilisateur connecté doit se voir attribuer un rôle Microsoft Entra pris en charge ou un rôle personnalisé avec une autorisation de rôle prise en charge. Les rôles les moins privilégiés suivants sont pris en charge pour cette opération.
Lire les propriétés de base sur la définition des modèles et des paramètres : administrateur local de l’appareil joint Microsoft Entra, lecteurs d’annuaire, lecteur général
Gérer tous les paramètres de groupe/répertoire - Enregistreurs d’annuaires
Gérer les paramètres globaux et locaux pour les groupes ; gérer Group.Unified.Guest et Group.Unified paramètres - administrateur Groupes
Mise à jour Password Rule Settings - Administrateur de stratégie d’authentification
Mettre à jour les paramètres, Lire les propriétés de base sur la définition des modèles et des paramètres - Administrateur d’utilisateurs
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new DirectorySetting
{
TemplateId = "08d542b9-071f-4e16-94b0-74abb372e3d9",
Values = new List<SettingValue>
{
new SettingValue
{
Name = "AllowToAddGuests",
Value = "false",
},
},
};
// 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}"].Settings.PostAsync(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.NewDirectorySetting()
templateId := "08d542b9-071f-4e16-94b0-74abb372e3d9"
requestBody.SetTemplateId(&templateId)
settingValue := graphmodels.NewSettingValue()
name := "AllowToAddGuests"
settingValue.SetName(&name)
value := "false"
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.Groups().ByGroupId("group-id").Settings().Post(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();
directorySetting.setTemplateId("08d542b9-071f-4e16-94b0-74abb372e3d9");
LinkedList<SettingValue> values = new LinkedList<SettingValue>();
SettingValue settingValue = new SettingValue();
settingValue.setName("AllowToAddGuests");
settingValue.setValue("false");
values.add(settingValue);
directorySetting.setValues(values);
DirectorySetting result = graphClient.groups().byGroupId("{group-id}").settings().post(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();
$requestBody->setTemplateId('08d542b9-071f-4e16-94b0-74abb372e3d9');
$valuesSettingValue1 = new SettingValue();
$valuesSettingValue1->setName('AllowToAddGuests');
$valuesSettingValue1->setValue('false');
$valuesArray []= $valuesSettingValue1;
$requestBody->setValues($valuesArray);
$result = $graphServiceClient->groups()->byGroupId('group-id')->settings()->post($requestBody)->wait();
# 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(
template_id = "08d542b9-071f-4e16-94b0-74abb372e3d9",
values = [
SettingValue(
name = "AllowToAddGuests",
value = "false",
),
],
)
result = await graph_client.groups.by_group_id('group-id').settings.post(request_body)
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new DirectorySetting
{
TemplateId = "62375ab9-6b52-47ed-826b-58e47e0e304b",
Values = new List<SettingValue>
{
new SettingValue
{
Name = "GuestUsageGuidelinesUrl",
Value = "https://privacy.contoso.com/privacystatement",
},
new SettingValue
{
Name = "EnableMSStandardBlockedWords",
Value = "true",
},
new SettingValue
{
Name = "EnableMIPLabels",
Value = "true",
},
new SettingValue
{
Name = "PrefixSuffixNamingRequirement",
Value = "[Contoso-][GroupName]",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Settings.PostAsync(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.NewDirectorySetting()
templateId := "62375ab9-6b52-47ed-826b-58e47e0e304b"
requestBody.SetTemplateId(&templateId)
settingValue := graphmodels.NewSettingValue()
name := "GuestUsageGuidelinesUrl"
settingValue.SetName(&name)
value := "https://privacy.contoso.com/privacystatement"
settingValue.SetValue(&value)
settingValue1 := graphmodels.NewSettingValue()
name := "EnableMSStandardBlockedWords"
settingValue1.SetName(&name)
value := "true"
settingValue1.SetValue(&value)
settingValue2 := graphmodels.NewSettingValue()
name := "EnableMIPLabels"
settingValue2.SetName(&name)
value := "true"
settingValue2.SetValue(&value)
settingValue3 := graphmodels.NewSettingValue()
name := "PrefixSuffixNamingRequirement"
settingValue3.SetName(&name)
value := "[Contoso-][GroupName]"
settingValue3.SetValue(&value)
values := []graphmodels.SettingValueable {
settingValue,
settingValue1,
settingValue2,
settingValue3,
}
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().Post(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();
directorySetting.setTemplateId("62375ab9-6b52-47ed-826b-58e47e0e304b");
LinkedList<SettingValue> values = new LinkedList<SettingValue>();
SettingValue settingValue = new SettingValue();
settingValue.setName("GuestUsageGuidelinesUrl");
settingValue.setValue("https://privacy.contoso.com/privacystatement");
values.add(settingValue);
SettingValue settingValue1 = new SettingValue();
settingValue1.setName("EnableMSStandardBlockedWords");
settingValue1.setValue("true");
values.add(settingValue1);
SettingValue settingValue2 = new SettingValue();
settingValue2.setName("EnableMIPLabels");
settingValue2.setValue("true");
values.add(settingValue2);
SettingValue settingValue3 = new SettingValue();
settingValue3.setName("PrefixSuffixNamingRequirement");
settingValue3.setValue("[Contoso-][GroupName]");
values.add(settingValue3);
directorySetting.setValues(values);
DirectorySetting result = graphClient.settings().post(directorySetting);
# 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(
template_id = "62375ab9-6b52-47ed-826b-58e47e0e304b",
values = [
SettingValue(
name = "GuestUsageGuidelinesUrl",
value = "https://privacy.contoso.com/privacystatement",
),
SettingValue(
name = "EnableMSStandardBlockedWords",
value = "true",
),
SettingValue(
name = "EnableMIPLabels",
value = "true",
),
SettingValue(
name = "PrefixSuffixNamingRequirement",
value = "[Contoso-][GroupName]",
),
],
)
result = await graph_client.settings.post(request_body)