更新组Update group

命名空间:microsoft.graphNamespace: microsoft.graph

更新 group 对象的属性。Update the properties of a group object.

权限Permissions

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限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) Group.ReadWrite.All、Directory.ReadWrite.All、Directory.AccessAsUser.AllGroup.ReadWrite.All, Directory.ReadWrite.All, Directory.AccessAsUser.All
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) 不支持。Not supported.
应用程序Application Group.ReadWrite.All、Directory.ReadWrite.AllGroup.ReadWrite.All, Directory.ReadWrite.All

HTTP 请求HTTP request

PATCH /groups/{id}

请求标头Request headers

名称Name 类型Type 说明Description
AuthorizationAuthorization stringstring Bearer {token}。必需。Bearer {token}. Required.

请求正文Request body

在请求正文中,提供应更新的相关字段的值。请求正文中不包括的现有属性将保留其以前的值,或根据对其他属性值的更改重新计算。为了获得最佳性能,不应包括尚未更改的现有值。In the request body, supply the values for relevant fields 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. For best performance you shouldn't include existing values that haven't changed.

属性Property 类型Type 说明Description
allowExternalSendersallowExternalSenders BooleanBoolean 默认为 false。指明组织外部人员能否向群组发送邮件。Default is false. Indicates if people external to the organization can send messages to the group.
autoSubscribeNewMembersautoSubscribeNewMembers BooleanBoolean 默认为 false。指示添加到组中的新成员是否将自动订阅接收电子邮件通知。Default is false. Indicates if new members added to the group will be auto-subscribed to receive email notifications.
descriptiondescription StringString 可选的组说明。An optional description for the group.
displayNamedisplayName StringString 组的显示名称。此属性是在创建组时所必需的,并且在更新过程中不能清除。The display name for the group. This property is required when a group is created and it cannot be cleared during updates.
groupTypesgroupTypes String collectionString collection 指定组类型及其成员身份。Specifies the group type and its membership.

如果集合包含 Unified,则该组是 Office 365 组,否则它是一个安全组。If the collection contains Unified then the group is an Office 365 group; otherwise it's a security group.

如果该集合包含 DynamicMembership,则该组具有动态成员身份;否则,成员身份是静态的。If the collection includes DynamicMembership, the group has dynamic membership; otherwise, membership is static.
mailEnabledmailEnabled 布尔Boolean 指定是否为启用邮件的组。Specifies whether the group is mail-enabled.
mailNicknamemailNickname StringString 组的邮件别名。The mail alias for the group. 创建组时必须指定此属性。This property must be specified when a group is created.
securityEnabledsecurityEnabled 布尔Boolean 指定是否为安全组。Specifies whether the group is a security group.
visibilityvisibility StringString 指定 Office 365 组的可见性。Specifies the visibility of an Office 365 group. 可能的是包括:专用公用或为空(解释为公用)。The possible values are: Private, Public, or empty (which is interpreted as Public).

注意:Note:

  • 可更新 autoSubscribeNewMembers,方法是在其自身的 PATCH 请求中指定它,而不包括上表中的其他属性。You can update autoSubscribeNewMembers by specifying it in its own PATCH request,without including the other properties in the table above.
  • 只有一部分与核心组管理和管理相关的组 API 才同时支持应用程序权限和委派权限。其他所有的组 API 成员(包括更新 autoSubscribeNewMembers)仅支持委派权限。有关示例,请参阅已知问题Only a subset of the group API pertaining to core group administration and management support application and delegated permissions. All other members of the group API, including updating autoSubscribeNewMembers, support only delegated permissions. See known issues for examples.
  • 在 Microsoft Exchange Server 中更新启用邮件的安全组的规则可能很复杂;若要了解详细信息,请参阅在 Exchange Server 中管理启用邮件的安全组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.

响应Response

如果成功,此方法返回 204 No Content 响应代码。If successful, this method returns a 204 No Content response code.

示例Example

以下示例演示如何创建组。The following example shows how to create a group.

请求Request

下面展示了示例请求。The following is an example of the request.

PATCH https://graph.microsoft.com/v1.0/groups/{id}
Content-type: application/json
Content-length: 211

{
  "description": "description-value",
  "displayName": "displayName-value",
  "groupTypes": [
    "groupTypes-value"
  ],
  "mail": "mail-value",
  "mailEnabled": true,
  "mailNickname": "mailNickname-value"
}

响应Response

下面展示了示例响应。The following is an example of the response.

HTTP/1.1 204 No Content