Atualizar groupSetting
Artigo
07/18/2022
6 minutos para o fim da leitura
3 colaboradores
Neste artigo
Namespace: microsoft.graph
Atualize as propriedades de um objeto groupSetting para configurações de grupo em todo o locatário ou uma configuração de grupo específica.
Permissões
Uma das seguintes permissões é obrigatória para chamar esta API. Para saber mais, incluindo como escolher permissões, confira Permissões .
Para todas as configurações, exceto o objeto Configurações de Política de Consentimento
Tipo de permissão
Permissões (da com menos para a com mais privilégios)
Delegada (conta corporativa ou de estudante)
Directory.ReadWrite.All
Delegada (conta pessoal da Microsoft)
Sem suporte.
Aplicativo
Directory.ReadWrite.All
Para o objeto Configurações de Política de Consentimento
As permissões a seguir são necessárias para atualizar o objeto directorySetting "Configurações de Política de Consentimento".
Tipo de permissão
Permissões (da com menos para a com mais privilégios)
Delegada (conta corporativa ou de estudante)
Policy.ReadWrite.Authorization
Delegada (conta pessoal da Microsoft)
Sem suporte.
Aplicativo
Policy.ReadWrite.Authorization
Solicitação HTTP
Atualize uma configuração em todo o locatário.
PATCH /groupSettings/{groupSettingId}
Atualize uma configuração específica do grupo.
PATCH /groups/{groupId}/settings/{groupSettingId}
Nome
Descrição
Autorização
{token}. Obrigatório.
Content-Type
application/json
Corpo da solicitação
No corpo da solicitação, forneça os valores para os campos relevantes que devem ser atualizados.
Propriedade
Tipo
Descrição
values
coleção settingValue
O conjunto atualizado de valores. Você deve incluir todo o conjunto de coleta. Não é possível atualizar um único conjunto de valores.
Resposta
Se tiver êxito, este método retornará um código de resposta 204 No Content.
Exemplos
Exemplo 1: atualizar uma configuração de grupo em todo o locatário
Neste exemplo, é 84af2ca5-c274-41bf-86e4-6e374ec4def6 o identificador do objeto groupSetting em todo o locatário.
Solicitação
PATCH https://graph.microsoft.com/v1.0/groupSettings/84af2ca5-c274-41bf-86e4-6e374ec4def6
Content-type: application/json
{
"values": [
{
"name": "AllowToAddGuests",
"value": "false"
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var groupSetting = new GroupSetting
{
Values = new List<SettingValue>()
{
new SettingValue
{
Name = "AllowToAddGuests",
Value = "false"
}
}
};
await graphClient.GroupSettings["{groupSetting-id}"]
.Request()
.UpdateAsync(groupSetting);
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var groupSetting = new GroupSetting
{
Values = new List<SettingValue>()
{
new SettingValue
{
Name = "AllowToAddGuests",
Value = "false"
}
}
};
await graphClient.GroupSettings["{groupSetting-id}"]
.Request()
.UpdateAsync(groupSetting);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK .
const options = {
authProvider,
};
const client = Client.init(options);
const groupSetting = {
values: [
{
name: 'AllowToAddGuests',
value: 'false'
}
]
};
await client.api('/groupSettings/84af2ca5-c274-41bf-86e4-6e374ec4def6')
.update(groupSetting);
const options = {
authProvider,
};
const client = Client.init(options);
const groupSetting = {
values: [
{
name: 'AllowToAddGuests',
value: 'false'
}
]
};
await client.api('/groupSettings/84af2ca5-c274-41bf-86e4-6e374ec4def6')
.update(groupSetting);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK .
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/groupSettings/84af2ca5-c274-41bf-86e4-6e374ec4def6"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphGroupSetting *groupSetting = [[MSGraphGroupSetting alloc] init];
NSMutableArray *valuesList = [[NSMutableArray alloc] init];
MSGraphSettingValue *values = [[MSGraphSettingValue alloc] init];
[values setName:@"AllowToAddGuests"];
[values setValue:@"false"];
[valuesList addObject: values];
[groupSetting setValues:valuesList];
NSError *error;
NSData *groupSettingData = [groupSetting getSerializedDataWithError:&error];
[urlRequest setHTTPBody:groupSettingData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/groupSettings/84af2ca5-c274-41bf-86e4-6e374ec4def6"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphGroupSetting *groupSetting = [[MSGraphGroupSetting alloc] init];
NSMutableArray *valuesList = [[NSMutableArray alloc] init];
MSGraphSettingValue *values = [[MSGraphSettingValue alloc] init];
[values setName:@"AllowToAddGuests"];
[values setValue:@"false"];
[valuesList addObject: values];
[groupSetting setValues:valuesList];
NSError *error;
NSData *groupSettingData = [groupSetting getSerializedDataWithError:&error];
[urlRequest setHTTPBody:groupSettingData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
GroupSetting groupSetting = new GroupSetting();
LinkedList<SettingValue> valuesList = new LinkedList<SettingValue>();
SettingValue values = new SettingValue();
values.name = "AllowToAddGuests";
values.value = "false";
valuesList.add(values);
groupSetting.values = valuesList;
graphClient.groupSettings("84af2ca5-c274-41bf-86e4-6e374ec4def6")
.buildRequest()
.patch(groupSetting);
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
GroupSetting groupSetting = new GroupSetting();
LinkedList<SettingValue> valuesList = new LinkedList<SettingValue>();
SettingValue values = new SettingValue();
values.name = "AllowToAddGuests";
values.value = "false";
valuesList.add(values);
groupSetting.values = valuesList;
graphClient.groupSettings("84af2ca5-c274-41bf-86e4-6e374ec4def6")
.buildRequest()
.patch(groupSetting);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewGroupSetting()
requestBody.SetValues( []SettingValue {
msgraphsdk.NewSettingValue(),
SetAdditionalData(map[string]interface{}{
"name": "AllowToAddGuests",
"value": "false",
}
}
groupSettingId := "groupSetting-id"
graphClient.GroupSettingsById(&groupSettingId).Patch(requestBody)
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewGroupSetting()
requestBody.SetValues( []SettingValue {
msgraphsdk.NewSettingValue(),
SetAdditionalData(map[string]interface{}{
"name": "AllowToAddGuests",
"value": "false",
}
}
groupSettingId := "groupSetting-id"
graphClient.GroupSettingsById(&groupSettingId).Patch(requestBody)
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK .
Resposta
HTTP/1.1 204 No Content
Exemplo 2: atualizar uma configuração de grupo específica
Neste exemplo, é 0167b5af-f3d1-4910-82d2-398747fa381c o identificador do grupo e fa6df613-159b-4f94-add2-7093f961900b é o identificador do objeto groupSetting.
Solicitação
PATCH https://graph.microsoft.com/v1.0/groups/0167b5af-f3d1-4910-82d2-398747fa381c/settings/fa6df613-159b-4f94-add2-7093f961900b
Content-type: application/json
{
"values": [
{
"name": "AllowToAddGuests",
"value": "true"
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var groupSetting = new GroupSetting
{
Values = new List<SettingValue>()
{
new SettingValue
{
Name = "AllowToAddGuests",
Value = "true"
}
}
};
await graphClient.Groups["{group-id}"].Settings["{groupSetting-id}"]
.Request()
.UpdateAsync(groupSetting);
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var groupSetting = new GroupSetting
{
Values = new List<SettingValue>()
{
new SettingValue
{
Name = "AllowToAddGuests",
Value = "true"
}
}
};
await graphClient.Groups["{group-id}"].Settings["{groupSetting-id}"]
.Request()
.UpdateAsync(groupSetting);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK .
const options = {
authProvider,
};
const client = Client.init(options);
const groupSetting = {
values: [
{
name: 'AllowToAddGuests',
value: 'true'
}
]
};
await client.api('/groups/0167b5af-f3d1-4910-82d2-398747fa381c/settings/fa6df613-159b-4f94-add2-7093f961900b')
.update(groupSetting);
const options = {
authProvider,
};
const client = Client.init(options);
const groupSetting = {
values: [
{
name: 'AllowToAddGuests',
value: 'true'
}
]
};
await client.api('/groups/0167b5af-f3d1-4910-82d2-398747fa381c/settings/fa6df613-159b-4f94-add2-7093f961900b')
.update(groupSetting);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK .
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/groups/0167b5af-f3d1-4910-82d2-398747fa381c/settings/fa6df613-159b-4f94-add2-7093f961900b"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphGroupSetting *groupSetting = [[MSGraphGroupSetting alloc] init];
NSMutableArray *valuesList = [[NSMutableArray alloc] init];
MSGraphSettingValue *values = [[MSGraphSettingValue alloc] init];
[values setName:@"AllowToAddGuests"];
[values setValue:@"true"];
[valuesList addObject: values];
[groupSetting setValues:valuesList];
NSError *error;
NSData *groupSettingData = [groupSetting getSerializedDataWithError:&error];
[urlRequest setHTTPBody:groupSettingData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/groups/0167b5af-f3d1-4910-82d2-398747fa381c/settings/fa6df613-159b-4f94-add2-7093f961900b"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphGroupSetting *groupSetting = [[MSGraphGroupSetting alloc] init];
NSMutableArray *valuesList = [[NSMutableArray alloc] init];
MSGraphSettingValue *values = [[MSGraphSettingValue alloc] init];
[values setName:@"AllowToAddGuests"];
[values setValue:@"true"];
[valuesList addObject: values];
[groupSetting setValues:valuesList];
NSError *error;
NSData *groupSettingData = [groupSetting getSerializedDataWithError:&error];
[urlRequest setHTTPBody:groupSettingData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
GroupSetting groupSetting = new GroupSetting();
LinkedList<SettingValue> valuesList = new LinkedList<SettingValue>();
SettingValue values = new SettingValue();
values.name = "AllowToAddGuests";
values.value = "true";
valuesList.add(values);
groupSetting.values = valuesList;
graphClient.groups("0167b5af-f3d1-4910-82d2-398747fa381c").settings("fa6df613-159b-4f94-add2-7093f961900b")
.buildRequest()
.patch(groupSetting);
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
GroupSetting groupSetting = new GroupSetting();
LinkedList<SettingValue> valuesList = new LinkedList<SettingValue>();
SettingValue values = new SettingValue();
values.name = "AllowToAddGuests";
values.value = "true";
valuesList.add(values);
groupSetting.values = valuesList;
graphClient.groups("0167b5af-f3d1-4910-82d2-398747fa381c").settings("fa6df613-159b-4f94-add2-7093f961900b")
.buildRequest()
.patch(groupSetting);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewGroupSetting()
requestBody.SetValues( []SettingValue {
msgraphsdk.NewSettingValue(),
SetAdditionalData(map[string]interface{}{
"name": "AllowToAddGuests",
"value": "true",
}
}
groupId := "group-id"
groupSettingId := "groupSetting-id"
graphClient.GroupsById(&groupId).SettingsById(&groupSettingId).Patch(requestBody)
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewGroupSetting()
requestBody.SetValues( []SettingValue {
msgraphsdk.NewSettingValue(),
SetAdditionalData(map[string]interface{}{
"name": "AllowToAddGuests",
"value": "true",
}
}
groupId := "group-id"
groupSettingId := "groupSetting-id"
graphClient.GroupsById(&groupId).SettingsById(&groupSettingId).Patch(requestBody)
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK .
Resposta
HTTP/1.1 204 No Content