此页面有用吗?
您对此内容的反馈非常重要。 请告诉我们您的想法。
更多反馈?
1500 个剩余字符
获取组成员

获取组成员

更新时间: 2015年5月

重要事项:本主题中的内容可能已过时。有关最新的 Azure AD Graph API 参考文档,请参阅新的交互式 Graph API 文档。使用交互式文档,你可以对文档内的示例租户尝试执行 REST 操作。只有在交互式文档中才会进行文档更新,本主题将在以后删除。

“获取组成员”操作获取组的成员。

可按如下方式构建请求。将 mytenantdomain 替换为你的 Azure Active Directory 租户所在的域,例如 contoso.onmicrosoft.comapi-version 查询字符串参数是必需的。如果 URI 中包含“$links”,则响应将只包含指向相关目录对象的链接。如果 URI 中省略了“$links”,则将返回对象本身。本主题中的示例使用租户域对租户寻址。有关对租户寻址的其他方式,请参阅对 Graph API 中的实体和操作进行寻址

 

HTTP 方法 请求 URI HTTP 版本

GET

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

HTTP 1.1

note备注
若要返回角色的成员,请指定“roles”作为资源集。还可以在请求 URI 中指定“directoryObjects”作为资源集,例如 https://graph.windows.net/contoso.onmicrosoft.com/directoryObjects/5e624f44-d38d-4943-b07c-2bad078f52ff/$links/members?api-version=2013-04-05。

 

请求标头 说明

授权

必需。Azure Active Directory 颁发的持有者令牌。有关更多信息,请参见Authentication Scenarios for Azure AD

Content-Type

必需。请求正文中内容的媒体类型。

Content-Length

必需。请求的长度(以字节为单位)。

对于此请求,没有必需的正文。

以下示例请求获取指定的组的成员。

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

此操作成功后返回状态代码 200 正常

 

响应标头 说明

ocp-aad-diagnostics-server-name

执行所请求操作的服务器的标识符。

ocp-aad-session-key

标识与目录服务进行的当前会话的键。

发送上面的示例请求时,将收到以下示例响应。该组包含两个成员:一个是组,一个是用户。

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"
        }
    ]
}

下面显示了以 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"
        }
    ]
}

另请参阅

概念



显示:
© 2015 Microsoft