views:

113

answers:

2

I know, it's a bit weird asking for a query to tell me my own email address right, I'll explain further...

I'm writing a COM add-in for Outlook 2007. One of the subs generates and sends an email to a particular address and this all works fine. However I have a need to have an option for the sender to be able to include themselves on the recipients list. As more than one person will be running this I cannot just set the sender's email address manually and would prefer to just add a check box on the form to enable this feature.

The only bit I'm stuck on is working out how to find the email address of the person sending the email. I could do it with an AD query against the logged on user but this needs to work for non-domain users also so need another method.

To put it more succinctly: Using VB, how can I return the primary email address associated with the logged-on user's current Outlook profile?

A: 

Hi,

Take a look using the property accessor to get the mapi property

If the account type is EX, PR_SMTP_ADDRESS or it DASL "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"

Though reading you question again are some the accounts non Exchange ?

Marcus

76mel
+1  A: 

Application.Session.CurrentUser.AddressEntry.GetExchangeUser.PrimarySmtpAddress
or
RDOSession.CurrentUser.SmtpAddress

bugtussle