Sometimes it seems that what we thought was the easiest problem to solve actually turns out taking the longest amount of time to figure out.
Case in point – finding the email address of the currently logged in user running Outlook in a VSTO plugin.
If you are looking to do this, see below and let the code set you free.
Recipient CurrentUser = this.Application.Session.CurrentUser; CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress.ToString()
A little longer and less direct than I would have thought (i.e., at this stage, my user is not a recipient to anything) but the reasoning becomes a little more apparent if I am trying to find the email addresses on a set of recipients on either an appointment or mail message.
.Recipients[1].AddressEntry.GetExchangeUser().PrimarySmtpAddress.ToString()
Post A Reply