簡體   English   中英

使用 Azure 圖表 API 獲取用戶下的用戶列表

[英]Get list of users under a user using Azure graph API

我正在尋找實現如下方法:

如果我將經理 ID 傳遞給我的方法,那么它需要向我提供向該經理報告的用戶列表。

我可以在哪里找到參考,如果我提供用戶 ID,它會為我提供用戶向其報告的經理。

獲取https://graph.windows.net/myorganization/users/john@contoso.onmicrosoft.com/$links/manager?api-version=1.6

https://docs.microsoft.com/en-us/previous-versions/azure/ad/graph/api/users-operations

但我需要反過來。 例如,我提供了經理 ID,我需要該經理下的用戶列表。

此處安裝 Microsoft Graph .NET SDK。

使用客戶端憑據提供程序生成 authProvider。

代碼示例:

IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
    .Create(clientId)
    .WithTenantId(tenantID)
    .WithClientSecret(clientSecret)
    .Build();

ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication);

GraphServiceClient graphClient = new GraphServiceClient(authProvider);

var directReports = await graphClient.Users["{upn or user_object_id}"].DirectReports
    .Request()
    .GetAsync();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM