Skip to content

Latest commit

 

History

History
288 lines (219 loc) · 10.8 KB

File metadata and controls

288 lines (219 loc) · 10.8 KB
title Create settings
description Create a new setting, based on the templates available in groupSettingTemplates.
ms.localizationpriority medium
author yuhko-msft
ms.reviewer mbhargav, khotzteam, aadgroupssg
ms.subservice entra-groups
doc_type apiPageType
ms.date 04/04/2024

Create settings

Namespace: microsoft.graph

Create a new group 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.

[!INCLUDE national-cloud-support]

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.

Create tenant-wide settings

[!INCLUDE permissions-table]

[!INCLUDE rbac-group-directorysettings-all]

Create group-specific settings

[!INCLUDE permissions-table]

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.

Examples

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]"
        }
    ]
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


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"
        }
    ]
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


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"
        }
    ]
}