groupSetting aktualisieren
Artikel
07/18/2022
6 Minuten Lesedauer
3 Mitwirkende
In diesem Artikel
Namespace: microsoft.graph
Aktualisieren Sie die Eigenschaften eines groupSetting-Objekts für mandantenweite Gruppeneinstellungen oder eine bestimmte Gruppeneinstellung.
Berechtigungen
Eine der nachfolgenden Berechtigungen ist erforderlich, um diese API aufrufen zu können. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie im Artikel zum Thema Berechtigungen .
Für alle Einstellungen außer dem Consent Policy Settings-Objekt
Berechtigungstyp
Berechtigungen (von der Berechtigung mit den wenigsten Rechten zu der mit den meisten Rechten)
Delegiert (Geschäfts-, Schul- oder Unikonto)
Directory.ReadWrite.All
Delegiert (persönliches Microsoft-Konto)
Nicht unterstützt
Anwendung
Directory.ReadWrite.All
Für das Consent Policy Settings-Objekt
Die folgenden Berechtigungen sind erforderlich, um das directorySetting-Objekt "Consent Policy Settings" zu aktualisieren.
Berechtigungstyp
Berechtigungen (von der Berechtigung mit den wenigsten Rechten zu der mit den meisten Rechten)
Delegiert (Geschäfts-, Schul- oder Unikonto)
Policy.ReadWrite.Authorization
Delegiert (persönliches Microsoft-Konto)
Nicht unterstützt
Anwendung
Policy.ReadWrite.Authorization
HTTP-Anforderung
Aktualisieren sie eine mandantenweite Einstellung.
PATCH /groupSettings/{groupSettingId}
Aktualisieren sie eine gruppenspezifische Einstellung.
PATCH /groups/{groupId}/settings/{groupSettingId}
Name
Beschreibung
Authorization
{token}. Erforderlich.
Content-Type
application/json
Anforderungstext
Geben Sie im Anforderungstext die Werte für die relevanten Felder an, die aktualisiert werden sollen.
Eigenschaft
Typ
Beschreibung
values
settingValue-Auflistung
Der aktualisierte Wertesatz. Sie müssen den gesamten Sammlungssatz einschließen. Sie können keinen einzelnen Satz von Werten aktualisieren.
Antwort
Wenn die Methode erfolgreich verläuft, wird der Antwortcode 204 No Content zurückgegeben.
Beispiele
Beispiel 1: Aktualisieren einer mandantenweiten Gruppeneinstellung
In diesem Beispiel 84af2ca5-c274-41bf-86e4-6e374ec4def6 ist der Bezeichner des mandantenweiten groupSetting-Objekts .
Anforderung
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);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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];
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
//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)
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
Antwort
HTTP/1.1 204 No Content
Beispiel 2: Aktualisieren einer bestimmten Gruppeneinstellung
In diesem Beispiel 0167b5af-f3d1-4910-82d2-398747fa381c ist der Bezeichner der Gruppe und fa6df613-159b-4f94-add2-7093f961900b der Bezeichner des groupSetting-Objekts.
Anforderung
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);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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];
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
//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)
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
Antwort
HTTP/1.1 204 No Content