group: getMemberGroupsgroup: getMemberGroups

重要

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.

返回指定组所属的所有组。检查是可传递的,这和读取 memberOf 导航属性不同,后者仅返回该组是其直接成员的组。Return all the groups that the specified group is a member of. The check is transitive, unlike reading the memberOf navigation property, which returns only the groups that the group is a direct member of.

此功能支持 Office 365 和 Azure AD 中设置的其他类型的组。每个请求可以返回的最大组数为 2046 组。注意:Office 365 组不能包含组。因此,Office 365 组中的成员身份始终是直接的。This function supports Office 365 and other types of groups provisioned in Azure AD. The maximum number of groups each request can return is 2046. Note that Office 365 Groups cannot contain groups. So membership in an Office 365 Group is always direct.

权限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) GroupMember、Group. all、Directory.accessasuser.all、、all、all、all 和。 AllGroupMember.Read.All, Group.Read.All, Directory.Read.All, Directory.ReadWrite.All, Directory.AccessAsUser.All
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) 不支持。Not supported.
应用程序Application GroupMember、Group. all、Read. all、All、All、AllGroupMember.Read.All, Group.Read.All, Directory.Read.All, Directory.ReadWrite.All

HTTP 请求HTTP request

POST /groups/{id}/getMemberGroups

请求标头Request headers

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

请求正文Request body

在请求正文中,提供具有以下参数的 JSON 对象。In the request body, provide a JSON object with the following parameters.

参数Parameter 类型Type 说明Description
securityEnabledOnlysecurityEnabledOnly BooleanBoolean 设置为 false。只支持对用户仅返回启用安全机制的组。Set to false. Returning only security-enabled groups is supported for users only.

响应Response

如果成功,此方法将在包含该组所属组 ID 的响应正文中返回 200 OK 响应代码和字符串集合。If successful, this method returns 200 OK response code and String collection in the response body that contains the IDs of the groups that the group is a member of.

示例Example

请求Request

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

POST https://graph.microsoft.com/beta/groups/{id}/getMemberGroups
Content-type: application/json
Content-length: 33

{
  "securityEnabledOnly": false
}

响应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 200 OK
Content-type: application/json
Content-length: 39

{
  "value": [
    "string-value"
  ]
}