Get a list of the group's members. A group can have users, devices, organizational contacts, and other groups as members. This operation is transitive and returns a flat list of all nested members.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Note: To list the members of a hidden membership group, the Member.Read.Hidden permission is required.
When an application queries a relationship that returns a directoryObject type collection, if it does not have permission to read a certain derived type (like device), members of that type are returned but with limited information. With this behaviour applications can request the least privileged permissions they need, rather than rely on the set of Directory.* permissions. For details, see Limited information returned for inaccessible member objects.
HTTP request
GET /groups/{id}/transitiveMembers
Optional query parameters
This method supports the OData query parameters to help customize the response, including $search, $count, and $filter. You can use $search on the displayName and description properties. When items are added or updated for this resource, they are specially indexed for use with the $count and $search query parameters. There can be a slight delay between when an item is added or updated and when it is available in the index.
To filter the results on the OData type, such as microsoft.graph.user or microsoft.graph.group, you must use the advanced query parameters. That is, the ConsistencyLevel header set to eventual and the $count=true query string.
Request headers
Name
Description
Authorization
Bearer {token}. Required.
ConsistencyLevel
eventual. This header and $count are required when using the $search, $filter, $orderby, or OData cast query parameters. It uses an index that might not be up-to-date with recent changes to the object.
Request body
Do not supply a request body for this method.
Response
If successful, this method returns a 200 OK response code and a collection of directoryObject objects in the response body.
Examples
Example 1: Get the transitive membership of a group
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
result, err := graphClient.GroupsById("group-id").TransitiveMembers().Get()
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestResult = $graphServiceClient->groupsById('group-id')->transitiveMembers()->get();
GET https://graph.microsoft.com/v1.0/groups/{id}/transitivemembers/microsoft.graph.group?$count=true
ConsistencyLevel: eventual
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var queryOptions = new List<QueryOption>()
{
new QueryOption("$count", "true")
};
var group = await graphClient.Groups["{group-id}"].TransitiveMembers
.Request( queryOptions )
.Header("ConsistencyLevel","eventual")
.GetAsync();
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestConfiguration = new GroupRequestBuilderGetRequestConfiguration();
$queryParameters = new GroupRequestBuilderGetQueryParameters();
$queryParameters->count = true;
$headers = [
'ConsistencyLevel' => 'eventual',
];
$requestConfiguration->queryParameters = $queryParameters;
$requestConfiguration->headers = $headers;
$requestResult = $graphServiceClient->groupsById('group-id')->transitiveMembers()->group()->get($requestConfiguration);
Example 4: Use OData cast and $search to get membership in groups with display names that contain the letters 'tier' including a count of returned objects
GET https://graph.microsoft.com/v1.0/groups/{id}/transitiveMembers/microsoft.graph.user?$count=true&$orderBy=displayName&$search="displayName:tier"&$select=displayName,id
ConsistencyLevel: eventual
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var queryOptions = new List<QueryOption>()
{
new QueryOption("$count", "true")
};
var user = await graphClient.Groups["{group-id}"].TransitiveMembers
.Request( queryOptions )
.Header("ConsistencyLevel","eventual")
.Search("displayName:tier")
.Select("displayName,id")
.OrderBy("displayName")
.GetAsync();
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestConfiguration = new UserRequestBuilderGetRequestConfiguration();
$queryParameters = new UserRequestBuilderGetQueryParameters();
$queryParameters->count = true;
$queryParameters->orderBy = ["displayName"];
$queryParameters->search = "\"displayName:tier\"";
$queryParameters->select = ["displayName","id"];
$headers = [
'ConsistencyLevel' => 'eventual',
];
$requestConfiguration->queryParameters = $queryParameters;
$requestConfiguration->headers = $headers;
$requestResult = $graphServiceClient->groupsById('group-id')->transitiveMembers()->user()->get($requestConfiguration);
GET https://graph.microsoft.com/v1.0/groups/{id}/transitiveMembers/microsoft.graph.user?$count=true&$orderBy=displayName&$filter=startswith(displayName, 'a')
ConsistencyLevel: eventual
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var queryOptions = new List<QueryOption>()
{
new QueryOption("$count", "true")
};
var user = await graphClient.Groups["{group-id}"].TransitiveMembers
.Request( queryOptions )
.Header("ConsistencyLevel","eventual")
.Filter("startswith(displayName, 'a')")
.OrderBy("displayName")
.GetAsync();
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestConfiguration = new UserRequestBuilderGetRequestConfiguration();
$queryParameters = new UserRequestBuilderGetQueryParameters();
$queryParameters->count = true;
$queryParameters->orderBy = ["displayName"];
$queryParameters->filter = "startswith(displayName,%20'a')";
$headers = [
'ConsistencyLevel' => 'eventual',
];
$requestConfiguration->queryParameters = $queryParameters;
$requestConfiguration->headers = $headers;
$requestResult = $graphServiceClient->groupsById('group-id')->transitiveMembers()->user()->get($requestConfiguration);