Cannot retreive sender email from Outlook.MailItem

DimkaNewtown

Active member
Joined
Jan 21, 2003
Messages
43
Location
New York City
I am writing an Outlook Add-In in C# that will (upon click of a button) take the selected message in the folder and save it to a database.

My problem is that I HAVE to have the sender email address. It would be even better if I could get the Reply-To address.

Unfortunately the Outlook.MailItem object does not expose those
properties and the SenderName property is no help at all.

Im stumped. :(

I have spent hours on this problem and I find it quite ridiculous. :mad:


Thanks!

-Dmitri
 
Bit of a cheat but here you go... This is Outlook VBA, i.e. not VB.Net-adjusted code, but it should get you started.
Code:
Dim itm As MailItem, r As MailItem
Set itm = ActiveExplorer.Selection.Item(1)
Set r = itm.Reply
MsgBox r.Recipients.Item(1).Address
 
herilane said:
Bit of a cheat but here you go... This is Outlook VBA, i.e. not VB.Net-adjusted code, but it should get you started.
Code:
Dim itm As MailItem, r As MailItem
Set itm = ActiveExplorer.Selection.Item(1)
Set r = itm.Reply
MsgBox r.Recipients.Item(1).Address

So the recipients.Item(1).Address will always contain the email of the person where it came from? What if there are people on the CC list?
 
Back
Top