我正在寻找实现如下所示的方法:
如果我将经理 ID 传递给我的方法,那么它需要向我提供向该经理报告的用户列表。
我可以找到引用资料,如果我提供用户 ID,它会向我提供用户报告的经理。
获取https://graph.windows.net/myorganization/users/[email protected]/$links/manager?api-version=1.6
https://learn.microsoft.com/en-us/previous-versions/azure/ad/graph/api/users-operations
但我需要相反。比如,我提供了经理 ID,并且需要该经理下的用户列表。
最佳答案
安装 Microsoft Graph .NET SDK here .
使用Client credentials provider生成 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();
关于c# - 使用 Azure 图形 API 获取用户下的用户列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66323017/