简体   繁体   中英

How to get azure ad user properties using microsoft graph api

I have saved some of the users in azure ad and now trying to get the properties of the users. For this I am using below api:

1. https://graph.microsoft.com/v1.0/users/

Documentation: https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http

The above API responds with the default properties, so if you want to get more properties, you have to specifically mention them in the request like:

2. https://graph.microsoft.com/v1.0/users/?$select=userPrincipalName,givenName,surname,businessPhones,officeLocation,companyName

Now the above api is giving me the appropriate response but it only list down the user which are on first page. If you want to get the list of all the users, then you need to mention top in your request like:

3. https://graph.microsoft.com/v1.0/users?$top=998

Above api will give you all the user list. But I am unable to understand how can I merge the 2 and 3 so that it gives me all the user list but the properties which I have mentioned. Thanks

Just try this:

GET https://graph.microsoft.com/v1.0/users/?$select=userPrincipalName,givenName,surname,businessPhones,officeLocation,companyName&$top=998

Using & to connect all query params

Result: 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM