I am trying to query group owners along with a few properties of the groups. When I add $select
the owners
property gets dropped. I need $select
to reduce the amount of data returned. Any way to achieve both?
/beta/groups?$expand=owners&$filter=startswith(mailNickname, 'rtan')&$top=999&$select=mailEnabled,owners
Response (has mailEnabled
but is missing owners
):
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#groups(mailEnabled,owners)",
"value": [
{
"mailEnabled": true
},
{
"mailEnabled": true
},
{
"mailEnabled": true
}
]
}
One workaround at the moment to combine both $select
and $expand
for /groups
endpoint would be to specify asterisk (*) character in $select
expression.
For example, the following query:
https://graph.microsoft.com/beta/groups?expand=owners&select=owners,*
will return all the group details along with owners
Matthieu - thanks for pointing this out. If you try the query without $select you'll see that the expansion does work. This issue is one of our documented known issues (see https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#query-parameter-limitations). I'm not saying that doesn't make things better - clearly in this case $select and $expand in the same request should just work.
BTW - As Marc correctly points out, it's either or, but this isn't just a groups
issue. It's across the board for all directory based entity types (users, groups, devices, applications, service principals, etc).
I don't have an ETA for a fix I'm afraid, but it is something that is being worked on.
Hope this helps,