arseniyandru
arseniyandru

Reputation: 798

Using $expand in Graph API query with multiple attributes?

Is it possible to $expand multiple attributes. For example:

https://graph.microsoft.com/beta/me?$expand=memberOf,manager

This will result in an error.

The result of parsing $expand contained at least 2 items, but the maximum allowed is 1.

Upvotes: 5

Views: 13910

Answers (3)

Doug Chandler
Doug Chandler

Reputation: 57

The same seems to be true for a Group, you cannot get the Owners and Members at the same time! This is very limiting so you need to make multiple calls to get the information.

Upvotes: 0

Dan Rosenberg Osted
Dan Rosenberg Osted

Reputation: 61

EDIT: I know this is quite an old question, but for anyone ending here in the future:

It is possible (in some cases) with the following syntax:

$expand=relation1($select=id,name),relation2($expand=relation2a($select=id))

It is difficult to determine where expands will work since the documentation is quite evasive, but I have made the above work successfully. Perhaps the missing piece for your case is to specify the inner query paremeters in your expands?

Example:

https://graph.microsoft.com/v1.0/me/messages/AAMkADFjM...ATjA9VZAAA=?$expand=singleValueExtendedProperties($filter=id eq 'string 0x1a'),microsoft.graph.eventMessage/event

Upvotes: 6

Nan Yu
Nan Yu

Reputation: 27528

Please refer to document($expand section) :

https://developer.microsoft.com/en-us/graph/docs/overview/query_parameters

If you query on the user resource, you can use $expand to get the properties of only one child object or collection at a time.

And here is a discussion about same topic :

However, specific entities may still have limits and for users it is still limited to a single expanded navigation. That is not expected to change.

Upvotes: 2

Related Questions