How can I get more results from an expanded entity?

Gareth Doherty 21 Reputation points
2022-03-04T13:49:04.083+00:00

Using this example

https://graph.microsoft.com/v1.0/users?$expand=memberOf  

This will return my users in Azure AD, and then have a list of the groups they are members of... as expected.

But what I have noticed is the list of groups only has a maximum of 20. Many many users have far more than 20 groups they are a member of.

What can I add to the query to allow me to return all groups that a user is a member of?

180212-image.png

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,777 questions
0 comments No comments
{count} votes

Accepted answer
  1. Srinivasa Rao Darna 6,696 Reputation points Microsoft Vendor
    2022-03-04T14:51:27.757+00:00

    Hi @Gareth Doherty ,

    This is a known limitation of $expand:Returns a maximum of 20 objects., you have to look at alternatives and work with direct /users/{id}/memberOf API.

    GET /users/{id | userPrincipalName}/memberOf  
    

    Hope this helps.
    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Gareth Doherty 21 Reputation points
    2022-03-04T16:26:49.47+00:00

    Thanks @SrinivasaRaoDarnaMSFT-7657 I knew I was missing something.

    My org has 1000's of Groups and 1000's of members/users.

    Doing any sort of Loop over either of those numbers to get all the details is going to be interesting :)

    I did see that the Group graph has a Delta endpoint, so possibly I can do one big data seed, then just use deltas there after to keep it in sync with my system.

    0 comments No comments