我已在 azure ad
中保存了一些用户,现在尝试获取用户的属性。为此,我使用以下 api:
1. https://graph.microsoft.com/v1.0/users/
文档:https://learn.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http
上述 API 使用默认属性进行响应,因此如果您想获取更多属性,则必须在请求中特别提及它们,例如:
2. https://graph.microsoft.com/v1.0/users/?$select=userPrincipalName,givenName,surname,businessPhones,officeLocation,companyName
现在上面的 api 给了我适当的响应,但它只列出了第一页上的用户。如果您想获取所有用户的列表,那么您需要在请求中提及 top
,例如:
3. https://graph.microsoft.com/v1.0/users?$top=998
以上 api 将为您提供所有用户列表。但我无法理解如何合并 2
和 3
以便它为我提供除我提到的属性之外的所有用户列表。谢谢
最佳答案
试试这个:
GET https://graph.microsoft.com/v1.0/users/?$select=userPrincipalName,givenName,surname,businessPhones,officeLocation,companyName&$top=998
使用&
连接所有查询参数
关于azure - 如何使用 microsoft graph api 获取 azure ad 用户属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65695414/