2

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?

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
Mavi Domates
  • 4,262
  • 2
  • 26
  • 45

1 Answers1

1

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,

Dan Kershaw - MSFT
  • 5,833
  • 1
  • 14
  • 23
  • also to add, the Group API entity permission scope is 'high-privilege', requiring admin consent in an organization – Nth.gol May 08 '18 at 22:03