Update group
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.
Update the properties of a group object.
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) | Group.ReadWrite.All | Directory.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | Group.ReadWrite.All | Directory.ReadWrite.All |
HTTP request
PATCH /groups/{id}
Request headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer {token}. Required. |
Request body
In the request body, supply only the values for properties that should be updated. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values.
The following table specifies the properties that can be updated.
Property | Type | Description |
---|---|---|
allowExternalSenders | Boolean | Default is false . Indicates whether people external to the organization can send messages to the group. |
assignedLabels | assignedLabel collection | The list of sensitivity label pairs (label ID, label name) associated with a Microsoft 365 group. |
autoSubscribeNewMembers | Boolean | Default is false . Indicates whether new members added to the group will be auto-subscribed to receive email notifications. autoSubscribeNewMembers can't be true when subscriptionEnabled is set to false on the group. |
description | String | An optional description for the group. |
displayName | String | The display name for the group. This property is required when a group is created and it cannot be cleared during updates. |
mailNickname | String | The mail alias for the group, unique for Microsoft 365 groups in the organization. Maximum length is 64 characters. This property can contain only characters in the ASCII character set 0 - 127 except the following: @ () \ [] " ; : . <> , SPACE . |
preferredDataLocation | String | The preferred data location for the Microsoft 365 group. To update this property, the calling user must be assigned at least one of the following Microsoft Entra roles:
For more information about this property, see OneDrive Online Multi-Geo. |
securityEnabled | Boolean | Specifies whether the group is a security group, including Microsoft 365 groups. |
uniqueName | String | The unique identifier that can be assigned to a group and used as an alternate key. Can updated only if null and is immutable once set. |
visibility | String | Specifies the visibility of a Microsoft 365 group. Possible values are: Private, Public, or empty (which is interpreted as Public). |
writebackConfiguration | groupWritebackConfiguration | Specifies whether or not a group is configured to write back group object properties to on-premise Active Directory. These properties are used when group writeback is configured in the Microsoft Entra Connect sync client. |
Important
- To update the following properties, you must specify them in their own PATCH request, without including the other properties listed in the previous table: allowExternalSenders, autoSubscribeNewMembers, hideFromAddressLists, hideFromOutlookClients, isSubscribedByMail, unseenCount.
- Only a subset of the group API that pertains to core group administration and management supports application and delegated permissions. All other members of the group API, including updating autoSubscribeNewMembers, support only delegated permissions.
- The rules for updating mail-enabled security groups in Microsoft Exchange Server can be complex; to learn more, see Manage mail-enabled security groups in Exchange Server.
- Application permissions are not supported when updating assignedLabels.
Manage extensions and associated data
Use this API to manage the directory, schema, and open extensions and their data for groups, as follows:
- Add, update and store data in the extensions for an existing group.
- For directory and schema extensions, remove any stored data by setting the value of the custom extension property to
null
. For open extensions, use the Delete open extension API.
Response
If successful, this method returns a 204 No Content
response code—except a 200 OK
response code when updating the following properties: allowExternalSenders, autoSubscribeNewMembers, hideFromAddressLists, hideFromOutlookClients, isSubscribedByMail, unseenCount.
Examples
Example 1: Update display name and description of a group
Request
The following example shows a request.
PATCH https://graph.microsoft.com/beta/groups/0d09007d-45b2-458c-b180-880dde3a302e
Content-type: application/json
{
"description":"Contoso Life v2.0",
"displayName":"Contoso Life Renewed"
}
Response
The following example shows the response.
HTTP/1.1 204 No Content
Example 2: Apply sensitivity label to a Microsoft 365 group
Request
You can obtain the ID of the label you want to apply to a Microsoft 365 group by using List label. Then you can update the assignedLabels property of the group with the label ID.
Note: Use of this API to apply sensitivity labels to Microsoft 365 groups is only supported for delegated permission scenarios.
PATCH https://graph.microsoft.com/beta/groups/{id}
Content-type: application/json
{
"assignedLabels":
[
{
"labelId" : "45cd0c48-c540-4358-ad79-a3658cdc5b88"
}
]
}
Response
The following example shows the response.
HTTP/1.1 204 No Content
Related content
Váš názor
https://aka.ms/ContentUserFeedback.
Připravujeme: V průběhu roku 2024 budeme postupně vyřazovat problémy z GitHub coby mechanismus zpětné vazby pro obsah a nahrazovat ho novým systémem zpětné vazby. Další informace naleznete v tématu:Odeslat a zobrazit názory pro