How to get both a name and email address in a DL

S

scottb2

I'm using the following code to create a distribution list. Once th
list is created, I go to Contacts, click on the DL, and see that the D
member has the email address for both the name and email addr fields.
How do I create a DL recipient that has the desired name fiel
(different from the email address)?

Thanks,
Scott


Code
-------------------

oDL = oApp.CreateItem(Outlook.OlItemType.olDistributionListItem)
as Outlook.DistListItem;

tempItem = oApp.CreateItem(Outlook.OlItemType.olMailItem) as Outlook.MailItem;
oRecipients = tempItem.Recipients;
oDL.DLName = "Associate Email Distribution List";
foreach (Outlook.ContactItem oContact in contactList)
{
oRecipients.Add(oContact.Email1Address);
}
resolveRet = oRecipients.ResolveAll();
oDL.AddMembers(oRecipients);
oDL.Save()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top