Recipient name as shown on the message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm developing an Outlook add-in and I trying to capture the recipient name
in the same format as it is shown on the message as follows:

Assume you reply to an e-mail and you see the following resolved e-mail
address in the "To" field:
John Doe <[email protected]>
I would like to capture the above entire string in my add-in. (Note: The
MailItem.To property will only return the display name, which is 'John Doe'.)

Is there any other property of either the MailItem or the Inspector, that
will return the string that the user sees on the screen?

Do I have to recreate the string myself? The problem with this case is that
Global address book addresses have different format (i.e. only the display
name is shown) on the screen.

Thanks,

Istvan
 
Do you really need whatever Outlook displays or the e-mail address? In the
latter case, use the MailItem.Recipients colection to read the
Recipient.Name and Recipient.Address properties.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Hi Dmitr,

Unfortunately I need what Outlook shows on the screen.

Without going into much details, what I'm trying to do is to pop up a dialog
box from the message window and I want to show the same "To" list to the user
on the dialog, so that the user doesn't get confused why one shows the email
address and why the other doesn't.

I see that I can reproduce what Outlook shows by looking into each
recipient's AddressEntry.AddressEntryUserType in Outlook 2007 or the
AddressEntry.Type field, if I want to run the code on both 2003 and 2007, but
I would have preferred to get this info from Outlook, since replicating a
piece of code is always a potential place for errors.

Thanks for your reply,

Istvan
 
Back
Top