/me$expand=transitiveMemberOf is returning memberOf, not transitiveMemberOf

Phil Hughes 1 Reputation point
2022-02-24T22:54:09.363+00:00

I'm trying to get all groups the signed in user is a part of (both direct and indirect) using the /me endpoint with the $expand=transitiveMemberOf query (it has to be using expand due to the implementation).

This query, however, seems to be returning the same as using $expand=memberOf.
I'm aware the $expand query has an issue with only returning 20 items, but memberOf is returning 5. Even transitiveMemberOf should be just returning 11.

I'm stumped here! Any help very much appreciated :)

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

3 answers

Sort by: Most helpful
  1. CarlZhao-MSFT 42,031 Reputation points
    2022-02-25T02:59:16.49+00:00

    Hi @Phil Hughes

    You should call the /getMemberGroups endpoint to get all groups the signed in user is a part of (both direct and indirect). Check for this one is Transitive, so you're assured that all groups will be returned.

    177647-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Vasil Michev 106.3K Reputation points MVP
    2022-02-25T07:48:53.543+00:00

    Not sure I understand why you need to use $expand here? The "direct" calls seems to work fine for me:

    https://graph.microsoft.com/beta/me/memberOf?$count=true (returns 35 entries)
    vs
    https://graph.microsoft.com/beta/me/transitiveMemberOf?$count=true (returns 38 entries)

    1 person found this answer helpful.

  3. Ondřej Šebela 6 Reputation points
    2022-10-12T08:54:15.79+00:00

    I am seeing exactly the same issue. Expand for transitiveMemberOf is returning JUST content of MemberOf, a.k.a. incomplete results.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.