1

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
    }
  ]
}
Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
Matthieu Maitre
  • 422
  • 3
  • 15
  • 2
    Hmmm, this smells like a bug in the `/groups` API. I can confirm that, at the moment, you can either `$select` _or_ `$expand` but _not both_. Your call should work (although you should always handle paging instead of `$top=999`, `top` isn't a reliable way to "get everything"). – Marc LaFleur Aug 01 '18 at 14:47

2 Answers2

1

Thanks @Matthieu 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. I'm not saying that doesn't make things better — clearly in this case $select and $expand in the same request should just work.

Also @Marc 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.

James Risner
  • 5,451
  • 11
  • 25
  • 47
Dan Kershaw - MSFT
  • 5,833
  • 1
  • 14
  • 23
1

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

Vadim Gremyachev
  • 57,952
  • 20
  • 129
  • 193
  • @MatthieuMaitre But the response is literally the same as when you don't specify $select. Did you manage to reduce output size and select only specific group attributes along with owners? – Singlet Dec 03 '18 at 14:41