vbaoutlookdistribution-list

How to Add a Distribution List Item to a Distribution List?


I am attempting to add multiple child distribution lists as members of a parent distribution list through Outlook 2010 VBA.

The basic code that Sue Mosher posted online (where objItem is the child DL, as discovered via a For/Next loop) is:

Set objRecipient = Application.Session.CreateRecipient(objItem.Subject)
objRecipient.Resolve
objDistributionList.AddMember objRecipient

This is adding the child DL as "contact" rather than a member linking to the original child DL.
When I open the member, which is supposed to be the child DL within the parent DL, it appears as an email contact with an "UNKNOWN" email address.


Solution

  • You cannot do that in the Outlook Object Model.
    You can try to use Redemption (I am its author), which exposes RDODistListItem.AddContact method - it will let you pass ContactItem as well as DistListItem object as a parameter.