Se requiere uno de los siguientes permisos para llamar a esta API. Para obtener más información, incluido cómo elegir permisos, vea Permisos.
Para todas las configuraciones excepto el objeto Configuración de directiva de consentimiento
Tipo de permiso
Permisos (de menos a más privilegiados)
Delegado (cuenta profesional o educativa)
Directory.ReadWrite.All
Delegado (cuenta personal de Microsoft)
No admitida.
Aplicación
Directory.ReadWrite.All
Para el objeto Configuración de directiva de consentimiento
Los permisos siguientes son necesarios para actualizar el objeto "Configuración de directiva de consentimiento".
Tipo de permiso
Permisos (de menos a más privilegiados)
Delegado (cuenta profesional o educativa)
Policy.ReadWrite.Authorization
Delegado (cuenta personal de Microsoft)
No admitida.
Aplicación
Policy.ReadWrite.Authorization
Importante
En escenarios delegados con cuentas profesionales o educativas, al usuario que ha iniciado sesión se le debe asignar un rol de Microsoft Entra compatible o un rol personalizado con un permiso de rol admitido. Se admiten los siguientes roles con privilegios mínimos para esta operación.
Lee las propiedades básicas sobre la configuración de plantillas y configuraciones: Microsoft Entra administrador local de dispositivos unidos, lectores de directorios, lector global
Administrar toda la configuración de grupo o directorio: escritores de directorios
Administrar la configuración global y local de los grupos; administración Group.Unified.Guest y Group.Unified configuración: administrador de Grupos
Actualización Password Rule Settings : administrador de directivas de autenticación
Actualizar configuración, Leer propiedades básicas sobre la configuración de plantillas y configuraciones: Administrador de usuarios
Solicitud HTTP
Actualice una configuración de todo el inquilino.
PATCH /groupSettings/{groupSettingId}
Actualice una configuración específica del grupo.
PATCH /groups/{groupId}/settings/{groupSettingId}
Encabezados de solicitud
Nombre
Descripción
Autorización
{token}. Obligatorio.
Content-Type
application/json
Cuerpo de solicitud
En el cuerpo de la solicitud, proporcione los valores de los campos relevantes que deben actualizarse.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new GroupSetting
{
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.GroupSettings["{groupSetting-id}"].PatchAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewGroupSetting()
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
groupSettings, err := graphClient.GroupSettings().ByGroupSettingId("groupSetting-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);
GroupSetting groupSetting = new GroupSetting();
LinkedList<SettingValue> values = new LinkedList<SettingValue>();
SettingValue settingValue = new SettingValue();
settingValue.setName("AllowToAddGuests");
settingValue.setValue("false");
values.add(settingValue);
groupSetting.setValues(values);
GroupSetting result = graphClient.groupSettings().byGroupSettingId("{groupSetting-id}").patch(groupSetting);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\GroupSetting;
use Microsoft\Graph\Generated\Models\SettingValue;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new GroupSetting();
$valuesSettingValue1 = new SettingValue();
$valuesSettingValue1->setName('AllowToAddGuests');
$valuesSettingValue1->setValue('false');
$valuesArray []= $valuesSettingValue1;
$requestBody->setValues($valuesArray);
$result = $graphServiceClient->groupSettings()->byGroupSettingId('groupSetting-id')->patch($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.group_setting import GroupSetting
from msgraph.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 = GroupSetting(
values = [
SettingValue(
name = "AllowToAddGuests",
value = "false",
),
],
)
result = await graph_client.group_settings.by_group_setting_id('groupSetting-id').patch(request_body)
Ejemplo 2: Actualización de una configuración de grupo específica
En este ejemplo, 0167b5af-f3d1-4910-82d2-398747fa381c es el identificador del grupo y fa6df613-159b-4f94-add2-7093f961900b es el identificador del objeto groupSetting.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new GroupSetting
{
Values = new List<SettingValue>
{
new SettingValue
{
Name = "AllowToAddGuests",
Value = "true",
},
},
};
// 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["{groupSetting-id}"].PatchAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewGroupSetting()
settingValue := graphmodels.NewSettingValue()
name := "AllowToAddGuests"
settingValue.SetName(&name)
value := "true"
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().ByGroupSettingId("groupSetting-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);
GroupSetting groupSetting = new GroupSetting();
LinkedList<SettingValue> values = new LinkedList<SettingValue>();
SettingValue settingValue = new SettingValue();
settingValue.setName("AllowToAddGuests");
settingValue.setValue("true");
values.add(settingValue);
groupSetting.setValues(values);
GroupSetting result = graphClient.groups().byGroupId("{group-id}").settings().byGroupSettingId("{groupSetting-id}").patch(groupSetting);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\GroupSetting;
use Microsoft\Graph\Generated\Models\SettingValue;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new GroupSetting();
$valuesSettingValue1 = new SettingValue();
$valuesSettingValue1->setName('AllowToAddGuests');
$valuesSettingValue1->setValue('true');
$valuesArray []= $valuesSettingValue1;
$requestBody->setValues($valuesArray);
$result = $graphServiceClient->groups()->byGroupId('group-id')->settings()->byGroupSettingId('groupSetting-id')->patch($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.group_setting import GroupSetting
from msgraph.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 = GroupSetting(
values = [
SettingValue(
name = "AllowToAddGuests",
value = "true",
),
],
)
result = await graph_client.groups.by_group_id('group-id').settings.by_group_setting_id('groupSetting-id').patch(request_body)