MSDN Library

取得群組成員

更新日期: 2015年5月

重要事項:本主題中的內容可能會過期。請參閱新的互動式圖形 API 文件,以取得 Azure AD Graph API 最新的參考文件。您可以參考互動式文件,從文件本身內的租用戶範例嘗試 REST 作業。文件更新只會在互動式文件上進行,且本主題將於未來移除。

「取得群組成員」作業會取得群組的成員。

此要求的建構如下。將 mytenantdomain 以您的 Azure Active Directory 租用戶網域取代,例如:contoso.onmicrosoft.com。需要 api-version 查詢字串參數。如果 URI 中併入了 "$links",回應將只會包含相關目錄物件的連結。如果 URI 中省略了 "$links",則會傳回物件本身。本主題中的範例是使用租用戶網域將租用戶定址。如需租用戶定址的其他方式,請參閱在 Graph API 中將實體和作業定址

 

HTTP 方法 要求 URI HTTP 版本

GET

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

HTTP 1.1

note附註
若要傳回角色的成員,請指定 "roles" 做為資源集。您也可以指定 "directoryObjects" 做為要求 URI 中的資源集;例如: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 OK

 

回應標頭 說明

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

另請參閱

概念

Group

顯示:
© 2016 Microsoft