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

  • Thread starter Thread starter Sandip Naskar
  • Start date Start date
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
 
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
 
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
 
Back
Top