Reputation: 4614
We are using Microsoft Graph APIs ( https://graph.microsoft.com/v1.0/
) to get all users from Azure Active Directory ( AAD ).
We get the basic user parameters as the response.
We don't get manager
, groups
& roles
of the user in the list users API paged response. We need to call separate API for an individual user with his AAD id
& get this additional information. We come across this $expand parameter in API documentation which states the following (emphasis mine):
Note: Not all relationships and resources support the $expand query parameter. For example, you can expand the directReports, manager, and memberOf relationships on a user, but you cannot expand its events, messages, or photo relationships. Not all resources or relationships support using $select on expanded items.
This note clearly suggests we shall get manager
& memberOf
properties for the user. But when we tried this with /users
API it throws bad requests.
Again we searched more in an article titled Known issues with Microsoft Graph it has the information about $expand
as follows,
$expand:
- No support for nextLink
- No support for more than 1 level of expand
- No support with extra parameters ($filter, $select)
What is the exact use of $expand
? How do we get additional information like manager, roles & groups of the user in List users API so that we don't have to call separate APIs per user?
Upvotes: 0
Views: 3417
Reputation: 1602
Below APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.
$expand-Normally, you can query either the properties of a resource or one of its relationships in a single request, but not both. You can use the $expand query string parameter to include the expanded resource or collection referenced by a single relationship (navigation property) in your results.
Memberof gives the groups, directory roles and administrative units that the user is a member of.
https://graph.microsoft.com/beta/users?$expand=memberof
To get manager details please use below query
https://graph.microsoft.com/beta/users?$expand=manager
Upvotes: 1