SenderEmailAddress in VB.NET on Outlook 2003

T

ThePope78705

I have an application in development that uses the VSTO 2005 libs to
create an addin to Outlook 2003. The application basically adds a
button to the New Mail Message window that, when clicked, sends
everything about the mail message to our server. One of the important
piece of information is the sender's email address.
This application cannot be deployed with either Redemption or CDO.
Is there a way to do this? Here is a snippet of the code I am writing

Dim mailMessage As Outlook.MailItem
Dim test as String
mailMessage = CType(myCurrentInspector.CurrentItem, Outlook.MailItem)

test = mailMessage.SenderEmailAddress

test is always nothing.
This is obviously a subset of the actual code, but am I missing
something?
 
K

Ken Slovak - [MVP - Outlook]

Is the open email message one that has been received? That's required for
any non-blank return value.

Your code works fine here, where are you calling it from? I put that code in
the Inspector.Activate() event handler. You should not try to run it in the
NewInspector event handler, where a weak object reference to Inspector
should not be used for much else than testing Inspector.CurrentItem.Class or
..MessageClass.
 

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