How to add contact to O365 distribution list using c#?

661 views Asked by At

How can I add/remove contacts to/from O365 distribution lists using C#?

In PowerShell this can be done using the commands Add-DistributionGroupMember, Remove-DistributionGroupMember from the module ExchangePowershell.

1

There are 1 answers

3
Eugene Astafiev On

It is not clear what technology you would like to use. There are several ways to get the job done in C#:

  1. Automate Outlook from your C# application. See How To: Create a new distribution list item in Outlook for more information. Note, Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment. Read more about that in the Considerations for server-side Automation of Office article.

  2. Use EWS, see Explore the EWS Managed API, EWS, and web services in Exchange for more information.

  3. Use Graph API, see Working with groups in Microsoft Graph.