MS Graph - Get owned Distribution Lists for a user

Robin McAninch 21 Reputation points
2022-02-23T18:18:09.62+00:00

I am trying to get all the distribution lists owned by a particular user

I made a call

v1.0/users/{upn}/ownedObjects

Then took the results based on MS info stating that a DL is when MailEnabled is true and SecurityEnabled is false

then since we were trying to exclude (by business request) to remove any with a groupType of "Unified"

and we aren't getting the data we are expecting. It does not look like the DL info is coming it by the ownedObjects call.

I don't need to know who is in the Lists (groups), I need to know for a given user their list of Distribution Lists using MS Graph API. Any help would be wonderful.

Use case.
User goes to screen.
User is presented with list of the distribution lists that they own

Further details (from MS documentations)

Group types in Azure AD and Microsoft Graph
Azure AD supports the following types of groups.

Microsoft 365 groups
Security groups
Mail-enabled security groups
Distribution groups
For more information about Azure AD groups, see compare groups in Azure AD.

In Microsoft Graph, the type of group can be identified by the settings of its groupType, mailEnabled, and securityEnabled properties

I want to be able to pull the Distribution Groups owned by a given user on demand

The only option we see right now is to pull all the groups in AD down then find each group's owner individually and store this info in a db table. The length of time would make it only worth running off hours and 99.999% of the data wouldn't change but in this model we would have to check each one.

Thank you.

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

1 answer

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,856 Reputation points
    2022-02-25T10:28:58.707+00:00

    Hello @Robin McAninch , I tested it locally and found that I can filter out three parameters. I think that the type of group can be judged by the values of the three parameters.

    177852-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.

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.