// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new GroupSetting
{
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.GroupSettings.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
GroupSetting groupSetting = new GroupSetting();
groupSetting.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);
groupSetting.setValues(values);
GroupSetting result = graphClient.groupSettings().post(groupSetting);
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new GroupSetting
{
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);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc groups settings create --group-id {group-id} --body '{\
"templateId": "08d542b9-071f-4e16-94b0-74abb372e3d9",\
"values": [\
{\
"name": "AllowToAddGuests",\
"value": "false"\
}\
]\
}\
'
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
GroupSetting groupSetting = new GroupSetting();
groupSetting.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);
groupSetting.setValues(values);
GroupSetting result = graphClient.groups().byGroupId("{group-id}").settings().post(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();
$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();