Create settings

Namespace: microsoft.graph

Create a new setting based on the templates available in groupSettingTemplates. These settings can be at the tenant-level or at the group level.

Group settings apply to only Microsoft 365 groups. The template named Group.Unified can be used to configure tenant-wide Microsoft 365 group settings, while the template named Group.Unified.Guest can be used to configure group-specific settings.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Directory.ReadWrite.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Directory.ReadWrite.All Not available.

For delegated scenarios, the calling user needs at least one of the following Microsoft Entra roles.

Microsoft Entra role Allowed privileges
Microsoft Entra Joined Device Local Administrator
Directory Readers
Global Reader
Read basic properties on setting templates and settings
Groups Administrator
Directory Writers
Manage all group settings
Authentication Policy Administrator Update Password Rule Settings
User Administrator Read basic properties on setting templates and settings
Update settings

HTTP request

Create a tenant-wide setting.

POST /groupSettings

Create a group-specific setting.

POST /groups/{id}/settings

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json

Request body

In the request body, supply a JSON representation of groupSetting object. The display name, templateId, and description are inherited from the referenced groupSettingTemplates object. Only the value property can be changed from the default value.

The following properties are required when creating the groupSetting object.

Parameter Type Description
templateId String Unique identifier for the tenant-level groupSettingTemplates object used to create this group-level settings object. Read-only.
values settingValue collection Collection of name-value pairs corresponding to the name and defaultValue properties in the referenced groupSettingTemplates object.

Response

If successful, this method returns 201 Created response code and groupSetting object in the response body.

Example 1: Create a new setting for all Microsoft 365 groups in the tenant

Request

Only the groupSettingTemplates object named Group.Unified can be applied to all Microsoft 365 groups at the tenant-level.

POST https://graph.microsoft.com/v1.0/groupSettings
Content-type: application/json

{
    "templateId": "62375ab9-6b52-47ed-826b-58e47e0e304b",
    "values": [
        {
            "name": "GuestUsageGuidelinesUrl",
            "value": "https://privacy.contoso.com/privacystatement"
        },
        {
            "name": "EnableMSStandardBlockedWords",
            "value": "true"
        },
        {
            "name": "EnableMIPLabels",
            "value": "true"
        },
        {
            "name": "PrefixSuffixNamingRequirement",
            "value": "[Contoso-][GroupName]"
        }
    ]
}

Response

Note: The response object shown here might be shortened for readability.

HTTP/1.1 201 Created
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groupSettings/$entity",
    "id": "844d252c-4de2-43eb-a784-96df77231aae",
    "displayName": null,
    "templateId": "62375ab9-6b52-47ed-826b-58e47e0e304b",
    "values": [
        {
            "name": "GuestUsageGuidelinesUrl",
            "value": "https://privacy.contoso.com/privacystatement"
        },
        {
            "name": "EnableMSStandardBlockedWords",
            "value": "true"
        },
        {
            "name": "EnableMIPLabels",
            "value": "true"
        },
        {
            "name": "PrefixSuffixNamingRequirement",
            "value": "[Contoso-][GroupName]"
        }
    ]
}

The displayName property and other name-value pairs will be populated with the default values from the groupSettingTemplates object that matches the templateId.

Example 2: Create a setting to block guests for a specific Microsoft 365 group

Request

Only the groupSettingTemplates object named Group.Unified.Guest can be applied to specific Microsoft 365 groups.

POST https://graph.microsoft.com/v1.0/groups/055a5d18-a3a9-4338-b9c5-de92559b7ebf/settings
Content-type: application/json

{
    "templateId": "08d542b9-071f-4e16-94b0-74abb372e3d9",
    "values": [
        {
            "name": "AllowToAddGuests",
            "value": "false"
        }
    ]
}

In the request body, supply a JSON representation of groupSetting object.

Response

Note: The response object shown here might be shortened for readability.

HTTP/1.1 201 Created
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groupSettings/$entity",
    "id": "a06fa228-3042-4662-bd09-33e298da1afe",
    "displayName": null,
    "templateId": "08d542b9-071f-4e16-94b0-74abb372e3d9",
    "values": [
        {
            "name": "AllowToAddGuests",
            "value": "false"
        }
    ]
}