Export (0) Print
Expand All

Get Group Members

Updated: August 30, 2013

The Get Group Members operation gets the members of a group.

Request URI

The request may be constructed as follows. Replace mytenantdomain with the domain of your Windows Azure Active Directory tenant, such as contoso.onmicrosoft.com. The api-version query string parameter is required. If “$links” is included in the URI, then the response will contain only links to the relevant directory objects. If “$links” is omitted from the URI, the objects themselves are returned. The examples in this topic use the tenant domain to address the tenant. For other ways of addressing the tenant, see Addressing Entities and Operations in the Graph.

 

HTTP Method Request URI HTTP Version

GET

https://graph.windows.net/mytenantdomain/groups/<objectId>/$links/members?api-version=2013-04-05

HTTP 1.1

noteNote
To return the members of a role, specify “roles” as the resource set. You can also specify “directoryObjects” as the resource set in the request URI; for example, https://graph.windows.net/contoso.onmicrosoft.com/directoryObjects/5e624f44-d38d-4943-b07c-2bad078f52ff/$links/members?api-version=2013-04-05.

Request Headers

 

Request Header Description

Authorization

Required. A bearer token issued by Windows Azure Access Control. See Windows Azure AD Graph Authentication for more information.

Content-Type

Required. The media type of the content in the request body.

Content-Length

Required. The length of the request in bytes.

Request Body

There is no body required for this request.

Sample Requests

The following sample request gets the members for the specified group.

GET https://graph.windows.net/contoso.onmicrosoft.com/groups/5e624f44-d38d-4943-b07c-2bad078f52ff/members?api-version=2013-04-05 HTTP/1.1
Authorization: Bearer eyJ0eX ... FWSXfwtQ
Content-Type: application/json
Host: graph.windows.net

Response

Status Code

A successful operation returns status code 200 OK.

Headers

 

Response Header Description

ocp-aad-diagnostics-server-name

The identifier for the server that performed the requested operation.

ocp-aad-session-key

The key that identifies the current session with the directory service.

Sample Response

The following sample response is received when the sample request above is sent. The group contains two members, one of which is a group and one of which is a user.

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 1304
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Server: Microsoft-IIS/7.5
ocp-aad-diagnostics-server-name: XDALV0qN1u6zqj4Uo0sPtNcrP2gqE1lnhxOWAGczrDE=
request-id: 26a7e238-a8c3-4301-bf6b-a9698d6b8a2a
client-request-id: 9e958745-8a74-4d33-8cc7-48c13f28a7ec
x-ms-dirapi-data-contract-version: 1.0
ocp-aad-session-key: k73UZDw2kpH2CGpEy3EZ6GDIcTxFw9ZX1z-CocvhjfbbjO-WETRNv5G_R42J24EQ5HvUepMB3P5Io9SuJCzg44TzE_yTh_r-IIm9MZ05cZA.1AQ8QhSZzAlRldlUmjrUFoYJL1DMlcEvjHcIlrdkgLA
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ARR/2.5
X-Powered-By: ASP.NET
Date: Sat, 06 Apr 2013 00:26:15 GMT

{
    "odata.metadata": "https://graph.windows.net/contoso.onmicrosoft.com/$metadata#directoryObjects",
    "value": [
        {
            "odata.type": "Microsoft.WindowsAzure.ActiveDirectory.Group",
            "objectType": "Group",
            "objectId": "8ab3f116-1afb-44cb-8e61-6b20cb1e353c",
            "description": null,
            "dirSyncEnabled": null,
            "displayName": "Nortwest Sales",
            "lastDirSyncTime": null,
            "mail": null,
            "mailNickname": "SalesNW",
            "mailEnabled": false,
            "provisioningErrors": [],
            "proxyAddresses": [],
            "securityEnabled": true
        },
        {
            "odata.type": "Microsoft.WindowsAzure.ActiveDirectory.User",
            "objectType": "User",
            "objectId": "fabeb27a-0481-4a80-b43e-a5c02c125874",
            "accountEnabled": true,
            "assignedLicenses": [],
            "assignedPlans": [],
            "city": null,
            "country": null,
            "department": null,
            "dirSyncEnabled": null,
            "displayName": "Isabel Martins",
            "facsimileTelephoneNumber": null,
            "givenName": null,
            "jobTitle": null,
            "lastDirSyncTime": null,
            "mail": null,
            "mailNickname": "IsabelM",
            "mobile": null,
            "otherMails": [],
            "passwordPolicies": null,
            "passwordProfile": null,
            "physicalDeliveryOfficeName": null,
            "postalCode": null,
            "preferredLanguage": null,
            "provisionedPlans": [],
            "provisioningErrors": [],
            "proxyAddresses": [],
            "state": null,
            "streetAddress": null,
            "surname": null,
            "telephoneNumber": null,
            "thumbnailPhoto@odata.mediaContentType": "image",
            "usageLocation": null,
            "userPrincipalName": "Isabel@contoso.onmicrosoft.com"
        }
    ]
}

The following shows the request and response if links are requested in the URI.

GET https://graph.windows.net/contoso.onmicrosoft.com/groups/5e624f44-d38d-4943-b07c-2bad078f52ff/$links/members?api-version=2013-04-05 HTTP/1.1
Authorization: Bearer eyJ0eX ... FWSXfwtQ
Content-Type: application/json
Host: graph.windows.net

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 460
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Server: Microsoft-IIS/7.5
ocp-aad-diagnostics-server-name: GpZBqv1HpLKoq8DomLBjVg0qidYJApbIcc5XfQ74dc8=
request-id: 2a65430f-e92f-4e99-845d-dd22f4df3524
client-request-id: 0cf003cf-e8ba-4d47-be8c-b0e576890e6f
x-ms-dirapi-data-contract-version: 1.0
ocp-aad-session-key: cGvmGh0xujGcgaoI9hcLYG_JQF4CVwhP8dpCg3Q3FxhaTfz65iTU3D_dflwwMml0ddy8UV0X_NAlPtVIdx9g3gwWI_DYwapLK0zCkODYk88WN2DurY1fwVb5jiQyG9MnLMib_bPQkNvfphqObmoo5g.a6HzeqsSRi3mzhIhmY8_7FxXfpsNnrRW1F1dHNsJ6vo
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ARR/2.5
X-Powered-By: ASP.NET
Date: Fri, 29 Mar 2013 17:56:28 GMT
{
    "odata.metadata": "https://graph.windows.net/contoso.onmicrosoft.com/$metadata#directoryObjects/$links/members",
    "value": [
        {
            "url": "https://graph.windows.net/contoso.onmicrosoft.com/directoryObjects/8ab3f116-1afb-44cb-8e61-6b20cb1e353c/Microsoft.WindowsAzure.ActiveDirectory.Group"
        },
        {
            "url": "https://graph.windows.net/contoso.onmicrosoft.com/directoryObjects/fabeb27a-0481-4a80-b43e-a5c02c125874/Microsoft.WindowsAzure.ActiveDirectory.User"
        }
    ]
}

See Also

Concepts

Group

Show:
© 2014 Microsoft