Export (0) Print
Expand All

Check Group Membership (transitive)

Updated: April 21, 2014

The Check Group Membership operation is performed by invoking the IsMemberOf function on the directory service. This function returns a Boolean value that indicates whether a specified user, group, or contact is a member of a specified group. The operation is transitive, that is, if User A is a member of Group B and Group B is a member of Group C and the function is invoked with User A and Group C as parameters, it will return true. You can contrast this with the memberOf navigation property for User A, which is intransitive and would therefore not return Group C in its result set because User A is a member of Group C only through its membership in Group B.

The request may be constructed as follows. Replace mytenantdomain with the domain of your Azure Active Directory tenant, such as contoso.onmicrosoft.com. The api-version query string parameter is required. 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 API.

 

HTTP Method Request URI HTTP Version

POST

https://graph.windows.net/mytenantdomain/isMemberOf?api-version=2013-04-05

HTTP 1.1

 

Request Header Description

Authorization

Required. A bearer token issued by Azure Access Control. See Authentication Scenarios for Azure AD 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.

The parameters to the function: groupId, the object ID of the group to check, and memberId, the object ID of the contact, group, or user to check for membership in the specified group.

The following sample request checks the membership of the specified object in the specified group.

POST https://graph.windows.net/contoso.onmicrosoft.com?api-version=2013-04-05 HTTP/1.1
Authorization: Bearer eyJ0eX ... FWSXfwtQ
Content-Type: application/json
Host: graph.windows.net
Content-Length: 108

{
"groupId":"5e624f44-d38d-4943-b07c-2bad078f52ff",
"memberId":"ea59e4d3-a7a1-4b5b-b65f-a25fcc0c0f99"
}


A successful operation returns status code 200 OK.

 

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.

The following sample response is received when the sample request above is sent. It indicates that the specified member object is a member of the specified group.

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 112
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Server: Microsoft-IIS/7.5
ocp-aad-diagnostics-server-name: 0KG3XJca10JBaCPPVyV6S/TPZvVBRyYmKz0GZKrigX0=
request-id: 0f6e8f9c-3491-4cfb-b879-552017c2607c
client-request-id: 0c0936e5-5bb3-4018-8f5b-5ecf20bd33ac
x-ms-dirapi-data-contract-version: 1.0
ocp-aad-session-key: 0q9HykNQlCqskP3L4QJuUOC5jb_JHzxWbpOn7gQdnwl5O_n4XARvKaIXcBpZfo45KLF1OHewKqoyEcI3M4DS9gzY88nvGFMAkhHRwVDrY6I0ItcZ1uza3nSHkpjCpKGPCZUNC-09A5zchBOD1N-UpA.3AbmtQAEUXHvIvb5yQlWlNqvmmbhah1nmyFT6Az9PXM
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 19:31:46 GMT

{
    "odata.metadata": "https://graph.windows.net/contoso.onmicrosoft.com/$metadata#Edm.Boolean",
    "value": true
}

See Also

Concepts

Group

Show:
© 2014 Microsoft