Forum Discussion
GRAPH - Add/remove user to distribution list
Hi micheleariis,
It is not possible to add user via the Graph API to a distribution list.
Add members - Microsoft Graph v1.0 | Microsoft Docs
Removing people is however possible
Remove member - Microsoft Graph v1.0 | Microsoft Docs
Delete https://graph.microsoft.com/beta/groups/{group id}/members/{user id}
One of the option you could consider is to use the Exchange online PowerShell command.
Install-module ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline
Get-DistributionGroup
#Copy name of distribution list
Get-DistributionGroupMember -Identity "<DL name>"
Add-DistributionGroupMember -Identity "<DL name>" -Member "<email user>"
Kind regards,
Rene
- Corey_EdwardsJul 04, 2024Copper Contributor
Mr_Helaas - this is not working for us. Well, it is, however it takes a minute to call and load the module each time we want to add a user. Why is this not possible directly with the Graph API like everything else?
- akb1985May 30, 2024Brass Contributor
Mr_Helaas could you please review my comment in the thread https://learn.microsoft.com/en-us/answers/questions/884912/managing-mail-enabled-security-groups-with-ms-grap and let me know your thoughts if I am getting it wrong.
- micheleariisDec 06, 2021Steel ContributorThrough powershell there is no problem, I would like to be able to do it directly from graph (Microsoft must have disabled it, up to 1 month ago it worked without problems). We used a mixed graph / c # code, at most I could do it directly from c # but I don't know how to do it.