How can I get more results from an expanded entity?

Gareth Doherty 21 Reputation points

Using this example$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?


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

    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

    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