Get To/CC Email address from a mail using Outlook COM object

S

Sandip Naskar

Hi All,

While creating a outlook addin, I am facing some problem in getting email address for To/CC.

Here is the code, I am using, (I am getting the selected mail from Outlook)

Outlook.MailItem OuItem;

OuItem = (Outlook.MailItem)applicationObject.Application.ActiveExplorer().Selection.Item(1);

string strTo = OuItem.To;


But I am always getting the name instead of address.

Any help would be highly appreciated.

Thank you all in advance.

Regards,
Sandip
 
S

Sue Mosher [MVP-Outlook]

Use the MailItem.Recipients collection. Each Recipient object has an Address property.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Hi All,

While creating a outlook addin, I am facing some problem in getting email address for To/CC.

Here is the code, I am using, (I am getting the selected mail from Outlook)

Outlook.MailItem OuItem;

OuItem = (Outlook.MailItem)applicationObject.Application.ActiveExplorer().Selection.Item(1);

string strTo = OuItem.To;


But I am always getting the name instead of address.

Any help would be highly appreciated.

Thank you all in advance.

Regards,
Sandip
 
S

Sandip Naskar

Thank you very much. It works.

Regards,
Sandip


Use the MailItem.Recipients collection. Each Recipient object has an Address
property.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Hi All,

While creating a outlook addin, I am facing some problem in getting email
address for To/CC.

Here is the code, I am using, (I am getting the selected mail from Outlook)

Outlook.MailItem OuItem;

OuItem =
(Outlook.MailItem)applicationObject.Application.ActiveExplorer().Selection.Item(1);

string strTo = OuItem.To;


But I am always getting the name instead of address.

Any help would be highly appreciated.

Thank you all in advance.

Regards,
Sandip
 

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