Redigera

Dela via


Update group

Namespace: microsoft.graph

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. Learn more about authentication and authorization.

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. This property can be updated only in delegated scenarios where the caller requires both the Microsoft Graph permission and a supported administrator role.
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:
  • User Account Administrator
  • Directory Writer
  • Exchange Administrator
  • SharePoint Administrator

For more information about this property, see OneDrive Online Multi-Geo.
securityEnabled Boolean Specifies whether the group is a security group.
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. The possible values are: Private, Public, or empty (which is interpreted as Public).

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.

Example

The following example shows how to update a group.

Request

The following example shows a request.

PATCH https://graph.microsoft.com/v1.0/groups/0d09007d-45b2-458c-b180-880dde3a302e
Content-type: application/json

{
  "description": "Library Assist - ADC",
  "displayName": "Library Assist - ADC",
  "mailNickname": "library-help-adc"
}

Response

The following example shows the response.

HTTP/1.1 204 No Content