MLPython
MLPython

Reputation: 1

Add email address to outlook distribution list

I have a distribution list under "Global Address List". I want to read the members of that group and add new members to the same distribution list. Is there anyway to do that in python using win32com?

I am able to read members of the distribution list. Need help with adding addresses to distribution list

python

import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
ns = outlook.GetNamespace("MAPI")
address_lists = ns.AddressLists.Item('Global Address List')
contacts = address_lists.AddressEntries.Item(MyGroup).Members
group_mail_list = []
for c in contacts:
       group_mail_list.append(c.GetExchangeUser().PrimarySmtpAddress.lower())

Upvotes: 0

Views: 840

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66316

You would not be able to modify GAL from the client side. It has to be done from the Exchange Admin Console.

Upvotes: 0

Related Questions