Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding the list of people in a distribution list (contact list) using graph API

I'm looking for a way to retrieve the list of people in a distribution list (contact list) in Outlook.com using the Microsoft Graph API.

So far I was able to retrieve the distribution group name etc.. using

https://graph.microsoft.com/v1.0/me/people?$search=DL_NAME

I'm certain that it's what I'm looking for because the result from API includes the following

"personType": {
  "class": "Group",
  "subclass": "PersonalDistributionList"
}

This is weird anyways, because it shows up using people endpoint and not the contacts.

What I need from this point on is to be able to retrieve the list of people in the distribution list. I've tried querying using the id in the result but it didn't work. Any ideas?

like image 625
Mavi Domates Avatar asked Sep 17 '25 07:09

Mavi Domates


1 Answers

Couple of things...

  1. DLs are actually represented by the group entity in Microsoft Graph, so in your case you should be able to use the id returned from your people search in the following to get the group/DLs members

GET https://graph.microsoft.com/v1.0/groups/{id}/members

  1. You could just search for your DL by filtering on the group entity:

GET https://graph.microsoft.com/v1.0/groups?$filter=displayName eq 'DL_NAME'

  1. The people API (see this topic) is really about people that you communicate with most often - and it includes users, groups and contacts.

Hope this helps,

like image 92
Dan Kershaw - MSFT Avatar answered Sep 19 '25 14:09

Dan Kershaw - MSFT