添加组所有者Add group owner

重要

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.

将用户添加到组所有者。所有者是一组具有 group 对象修改权限的非管理员用户。Add a user to the group's owners. The owners are a set of non-admin users who are allowed to modify the group object.

重要提示: 如果更新组所有者并为该组创建团队,则所有者与 Microsoft Team 同步需要最多花费 2 小时。Important: If you update the group owners and you created a team for the group, it can take up to 2 hours for the owners to be synchronized with Microsoft Teams. 此外,如果希望所有者能够在团队中进行更改,例如创建 Planner 计划,则还需要将所有者添加为组/团队成员。Also, if you want the owner to be able to make changes in a team - for example, by creating a Planner plan - the owner also needs to be added as a group/team member.

权限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

POST /groups/{id}/owners/$ref

请求标头Request headers

名称Name 说明Description
AuthorizationAuthorization Bearer {token}。必需。Bearer {token}. Required.
Content-typeContent-type application/json. Required.application/json. Required.

请求正文Request body

在请求正文中,提供要添加的user对象的 JSON 表示形式。In the request body, supply a JSON representation of the user object to be added.

响应Response

如果成功,此方法返回 204 No Content 响应代码。它不在响应正文中返回任何内容。If successful, this method returns a 204 No Content response code. It does not return anything in the response body.

示例Example

请求Request

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

POST https://graph.microsoft.com/beta/groups/{id}/owners/$ref
Content-type: application/json
Content-length: 30

{
  "@odata.id": "https://graph.microsoft.com/beta/users/{id}"
}

在请求正文中,提供要添加的 user 对象的 JSON 表示形式。In the request body, supply a JSON representation of user object to be added.

响应Response

下面是一个响应示例。The following is an example of the response.

注意: 为了提高可读性,可能缩短了此处显示的响应对象。Note: The response object shown here might be shortened for readability. 所有属性都将通过实际调用返回。All the properties will be returned from an actual call.

HTTP/1.1 204 No Content