I have a distribution list the Global Address List that I am the owner of. I would like to programmatically add/remove members from the list in VBA, instead of via the properties in Outlook.
I can reference the distribution list as an AddressEntry or an ExchangeDistributionList, and access member information like .Alias or .Type, but I cannot perform any add/remove functions. The entry in Microsoft .DistListItem has an AddMembers method but only describes adding members to a new distribution list. I cannot find any code for adding to existing distribution list.
This link asks my question, but the linked answer only shows how to display the members. It does not explain how to add/remove.
Any help would be appreciated!
Keep in mind that
DistListItem
represents anIPM.DistList
item in one of your contacts folders in the mailbox. It does not represent a GAL object, which is represented by theAddressEntry
andExchangeDistributionList
objects.To add a member to a DL, you can use
AddressEntry.Members.Add