更新组Update group

重要

Microsoft Graph 中/beta的版本下的 api 可能会发生更改。APIs under the /beta version in Microsoft Graph are subject to change. 不支持在生产应用程序中使用这些 API。Use of these APIs in production applications is not supported.

更新对象的属性。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.

如果集合包含统一的, 则组为 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 BooleanBoolean 指定该组是否启用邮件。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 BooleanBoolean 指定该组是否为安全组, 包括 Office 365 组。Specifies whether the group is a security group, including Office 365 groups.
visibilityvisibility StringString 指定 Office 365 组的可见性。可能的值是:专用公用或空(解释为公用)。Specifies the visibility of an Office 365 group. Possible values are: Private, Public, or empty (which is interpreted as Public).

由于资源支持扩展, 因此您可以使用该PATCH操作在现有实例中的扩展的自定义属性中添加、更新或删除您自己的应用程序特定的数据。Because the group resource supports extensions, you can use the PATCH operation to add, update, or delete your own app-specific data in custom properties of an extension in an existing group instance.

注意: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

请求Request

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

PATCH https://graph.microsoft.com/beta/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

另请参阅See also