Create a directory setting
Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
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.
Note: The /beta version of this API only applies to groups. The /v1.0 version of this API has been renamed to Create groupSettings.
For a list of templates and the properties they support in beta, use a directorySettingTemplate query. (For v1.0 endpoints, call groupSettingTemplates.)
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | Directory.ReadWrite.All, Directory.AccessAsUser.All |
Delegated (personal Microsoft account) | Not supported. |
Application | Directory.ReadWrite.All |
HTTP request
POST /settings
POST /groups/{id}/settings
Request headers
Name | Description |
---|---|
Authorization | Bearer {token}. 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"
}
]
}