CDO 1.21 is not supported for managed code, use Redemption for that. Or if
you are programming against Outlook 2007 use the new PropertyAccessor object
on the MailItem.
The headers are in property PR_TRANSPORT_MESSAGE_HEADERS (0x007D001E). Get
the selected mail item from the ActiveExplorer.Selection collection. Use
Selection.Count to see how many items are selected, if it's only 1 item then
use something like this snippet:
// app == Outlook.Application object, already instantiated
Outlook.MailItem mail = (Outlook.MailItem)app.ActiveExplorer().Selection[1];
string ID = mail.EntryID;
// session is RDOSession object, already instantiated
Redemption.RDOMail rMail = session.GetMessageFromID(ID, missing, missing);
string header = rMail.Fields(0x007D001E);
Of course this snippet doesn't do any error handling or checking if the item
is a MailItem, if no items are selected or if there are any headers.
Dinesh said:
hello everyone,
Can anyone help with the code how to programmtically read the internet
header of the selected email using c# with the VSTO and also i have
redemption and CDO .
thank you.