sganandhsg 0 Light Poster

Hi All,

I have created Add-In for Outlook 2007, 2010 and 2013 with VS 2010 (VSTO 4)
The requirment is to store the Email addresses (FROM and TO addresses) to one table.
I can able to get the TO email addresses in Outlook version 2010 and 2013, but unable to get the TO email addresses in Outlook version 2007.
When I tried using 2007, to get only the Name of that email address which was stored in contacts and unable to find the full Email address.

The same in 2010 and 2013 I can able to get full Email address using below code if retrive the values from mailItem.To as Name of that email address

Microsoft.Office.Interop.Outlook.Items OutlookItems;
string toAddress = mailItem.To[0].ToString();
for (int i = 0; i <= OutlookItems.Count; i++){
    if (OutlookItems[i + 1].MessageClass == "IPM.Contact" && OutlookItems[i + 1].Email1DisplayName == recipient.Trim())
    {
    Microsoft.Office.Interop.Outlook.ContactItem contact = (Microsoft.Office.Interop.Outlook.ContactItem)OutlookItems[i+1];
    toMailAddress = contact.Email1Address;
    }
}

Please help me to resolve the problem.

Thanks In Advance
Anandh

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.