S Andrew
S Andrew

Reputation: 7298

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://learn.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

Upvotes: 1

Views: 2326

Answers (1)

Stanley Gong
Stanley Gong

Reputation: 12153

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: enter image description here

Upvotes: 1

Related Questions