Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

List group members

Feedback

In this article

Namespace: microsoft.graph

Get a list of thegroup's direct members. A group can have users, organizational contacts, devices, service principals and other groups as members. This operation is not transitive.

Important

This API has a known issue where service principals are not listed as group members in v1.0. As a workaround, use this API on thebeta endpoint or use the/groups/{id}?$expand=members API. For more information, see the relatedknown issue.

This API is available in the followingnational cloud deployments.

Global serviceUS Government L4US Government L5 (DOD)China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissionsonly if your app requires it. For details about delegated and application permissions, seePermission types. To learn more about these permissions, see thepermissions reference.

Permission typeLeast privileged permissionsHigher privileged permissions
Delegated (work or school account)GroupMember.Read.AllDirectory.Read.All, Group.Read.All, Group.ReadWrite.All, GroupMember.ReadWrite.All
Delegated (personal Microsoft account)Not supported.Not supported.
ApplicationGroupMember.Read.AllDirectory.Read.All, Group.Read.All, Group.ReadWrite.All, GroupMember.ReadWrite.All

Important

When an application queries a relationship that returns adirectoryObject type collection, if it doesn't have permission to read a certain resource type, members of that type are returned but with limited information. For example, only the@odata.type property for the object type and theid is returned, while other properties are indicated asnull. With this behavior, applications can request the least privileged permissions they need, rather than rely on the set ofDirectory.* permissions. For details, seeLimited information returned for inaccessible member objects.

In delegated scenarios, the signed-in user must also be assigned a supportedMicrosoft Entra role or a custom role with themicrosoft.directory/groups/members/read ormicrosoft.directory/groups/members/limitedRead role permission, ormicrosoft.directory/groups/hiddenMembers/read role permission to read hidden members. The following least privileged roles are supported for this operation:

  • Group owners
  • "Member" users
  • "Guest" users - havelimited read permissions
  • Directory Readers
  • Directory Writers
  • Groups Administrator
  • User Administrator - Including hidden members
  • Exchange Administrator - Including hidden members
  • SharePoint Administrator - Including hidden members
  • Intune Administrator - Including hidden members
  • Teams Administrator - Including hidden members
  • Yammer Administrator - Including hidden members

To list the members of a hidden membership group, theMember.Read.Hidden permission is also required.

HTTP request

GET /groups/{id}/members

Optional query parameters

This method supports the$filter,$count,$select,$search,$top, and$expandOData query parameters to help customize the response.

  • OData cast is enabled. For example,/groups/{id}/members/microsoft.graph.user retrieves group members that are users.
  • $search is supported on thedisplayName anddescription properties only.
  • The use of query parameters with this API, except for$expand, is supported only with advanced query parameters.$expand isn't supported with advanced query parameters. For more information, seeAdvanced query capabilities on directory objects.

The default and maximum page size is 100 and 999 group objects respectively.

Request headers

HeaderValue
AuthorizationBearer {token}. Required. Learn more aboutauthentication and authorization.
ConsistencyLeveleventual. 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

Don't supply a request body for this method.

Response

If successful, this method returns a200 OK response code and a collection ofdirectoryObject objects in the response body.

An attempt to filter by an OData cast that represents an unsupported member type returns a400 Bad Request error with theRequest_UnsupportedQuery code. For example,/groups/{id}}/members/microsoft.graph.group when the group is a Microsoft 365 group will return this error, because Microsoft 365 groups cannot have other groups as members.

Examples

Example 1: Get the direct membership in a group

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/groups/02bd9fd6-8f93-4758-87c3-1fb73740a315/members

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OKContent-type: application/json{  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",  "value": [    {      "id": "11111111-2222-3333-4444-555555555555",      "mail": "user1@contoso.com"    }  ]}

Example 2: Get only a count of all membership

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/groups/02bd9fd6-8f93-4758-87c3-1fb73740a315/members/$countConsistencyLevel: eventual

Response

The following example shows the response.

HTTP/1.1 200 OKContent-type: text/plain893

Example 3: Use OData cast to get only a count of user membership

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/groups/{id}/members/microsoft.graph.user/$countConsistencyLevel: eventual

Response

The following example shows the response.

HTTP/1.1 200 OKContent-type: text/plain893

Example 4: Use $searchand OData cast to get user membership in groups with display names that contain the letters 'Pr' including a count of returned objects

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/groups/{id}/members/microsoft.graph.user?$count=true&$orderby=displayName&$search="displayName:Pr"&$select=displayName,idConsistencyLevel: eventual

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OKContent-type: application/json{  "@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users(displayName,id)",  "@odata.count":7,  "value":[    {      "displayName":"Joseph Price",      "id":"11111111-2222-3333-4444-555555555555"    },    {      "displayName":"Preston Morales",      "id":"66666666-7777-8888-9999-000000000000"    }  ]}

Example 5: Use $filter to get group membership with a display name that starts with the letter 'A' including a count of returned objects

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/groups/{id}/members?$count=true&$filter=startswith(displayName, 'a')ConsistencyLevel: eventual

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OKContent-type: application/json{  "@odata.context":"https://graph.microsoft.com/v1.0/$metadata#directoryObjects",  "@odata.count":76,  "value":[    {      "displayName":"AAD Contoso Users",      "mail":"AADContoso_Users@contoso.com"    }  ]}

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?