Outlook VBA Modify Members of Distribution List in GAL

126 Views Asked by At

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!

1

There are 1 best solutions below

0
On

Keep in mind that DistListItem represents an IPM.DistList item in one of your contacts folders in the mailbox. It does not represent a GAL object, which is represented by the AddressEntry and ExchangeDistributionList objects.

To add a member to a DL, you can use AddressEntry.Members.Add