Create a directory setting

Use this API to create a new setting, based on the templates available in directorySettingTemplates. These settings can be at the tenant-level or at an object level (currently only for groups). The creation request must provide settingValues for all the settings defined in the template. For group-specific settings, only the setting governing whether members of a group can invite guest users can be set. This will govern this behavior once the ability to add guest users to a group is generally available.

Prerequisites

The following scopes are required to execute this API: Directory.ReadWrite.All or Directory.AccessAsUser.All

HTTP request

POST /settings
POST /groups/{id}/settings

Request headers

Name Description
Authorization Bearer . Required.

Request body

In the request body, supply a JSON representation of directorySetting object. However, the display name for the setting will be set based on the referenced settings template name.

Response

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

Example

Request

Here is an example of the request.

POST https://graph.microsoft.com/beta/settings
Content-type: application/json
Content-length: 222

{
  "templateId": "templateId-value",
  "values": [
    {
      "name": "name-value",
      "value": "value-value"
    }
  ]
}

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

Response

Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

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

{
    "@odata.context": "https://graph.microsoft.com/stagingbeta/$metadata#settings/$entity",
    "id": "id-value",
    "displayName": "displayName-value",
    "templateId": "templateId-value",
    "values": [
      {
        "name": "name-value",
        "value": "value-value"
      }
    ]
}