index > Visual Studio Tools for Office > Email Address of the Current User

Email Address of the Current User

Hi,

How can I get the Email Address of the Login User from Outlook.

The Me.Session.CurrentUser.address return a lot of additional data, what I want is just the Email Address.

Thanks.

Andy Ho

Andy Ho

This is returning the X400 name for your exchange server. I am not sure this is possible through the basic Outlook Object Model, you could use LDAP and query the Exchange server settings to get the SMTP based address. This newsgroup is more for VSTO Related queries.

Sample VBScript file

' Create the ADSystem Information Object

Set objADSystemInfo = CreateObject("ADSystemInfo")
' Get the current information into a new Object
Set objUser = GetObject("LDAP://" & objADSystemInfo.UserName)

'Now use the mail property for the SMTP Address
Wscript.Echo "SMTP Address: " & objUser.mail

Additionally you could use CDO but this isnt supported using Managed code :(

Regards




Mike Walker MVP - Visual Developer VSTO - Please mark the best replies as Answers !
Mike Walker
To get the SMTP address from an Exchange sender or recipient in versions before Outlook 2007, use CDO 1.21 (which isn't supported in .NET languages) or Redemption and the PR_EMAIL (&H39FE001E) MAPI property to obtain the SMTP address from the AddressEntry object. See http://www.outlookcode.com/d/code/getsenderaddy.htm#redemption and http://www.cdolive.com/cdo5.htm#EMailAddressOfSender for examples. -- Sue Mosher, Outlook MVP wrote in message news:ca830d83-12e4-4e01-89ae-fc579c7d80ab@discussions.microsoft.com... > Hi, > > How can I get the Email Address of the Login User from Outlook. > > The Me.Session.CurrentUser.address return a lot of additional data, what > I want is just the Email Address. > > Thanks. > > Andy Ho > > > >
NNTP User

Thanks for the reply.

Really surprise that for a tool to write Outlook plug-in doesn't have any method to retrieve the user's email address. 8-(

Andy

Andy Ho
Outlook 2007 will return the SMTP address, even for Exchange users.
Sue Mosher - Outlook MVP
Yes, very surprising that it has to be so difficult. I _should be_ (but isn't) just as easy as something like this:
myEmailAddress = this.ActiveExplorer().Session.CurrentUser.EmailAddress; (Notice: EmailAddress was made up by me)

Is there really no other way, to get the current user's e-mail address, than using Redemption in .Net 2005 (using C#) since Redemption is costly.

I heard something about asking Active Directory for the e-mail address by giving it the current username (which is easy to retrieve).

If not, what about LDAP, could someone please show some example code on how to do that in C#? (that visual basic script above here really confuses me) ;)

Thanks in advance
Magnus



ripern
ripern
reply 6

You can use google to search for other answers

 

More Articles

• Is it possible to use Globals class outside the "Code behind...
• Uninstalling or upgrading existing outlook add-in
• LoaderLock exception thrown when calling Delete method on Command...
• adding column heading from a list with VB.NET onto excel using th...
• How to Develop a Com Addin that works for all versions of Office.
• [Solved] DataGridView appearance problem
• vsto code
• Word: text range to boundary rect
• Searching Files
• Do I need Tools for Office?
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• AppCheck.cpp...PIACheck.cpp
• Granting Full Trust
• VBA Item vs get_Item in C#
• VSTO 2005 Outlook Add-In Security Access
• HHC6003: Error: The file Itircl.dll has
• Creating tab delimited text files form e
• XP Style of WinForms using VSTO
• Outlook Add-in doesn't work after instal
• taskpane
• How to do this in C#
• How to create an extended worksheet from
• VSTO project does not appear in "VS
• Make a segment in a word document read o
• How should I deploy my managed COM add-in
• Grant full trust using setup project

Hot Articles

• Supported Office Versions
• Dynamic Array of NamedRanges
• outlook plug-in help
• VSTO, WSE 3.0 Permission / Security error
• KeyPress Event in .Dot Files
• Word 2003 with VSTO 2003 stops working w
• How to get the Excel dialog that allows
• Dynamic SQL Generation is not supported
• Selection.PasteExcelTable not working co
• how to insert a string in html format in
• Read Excel 2003 XML Spreadsheet and save
• MODI not working with Windows 2003 Server
• Access Developer Extensions IN VS2005
• Adding InfoPath Form as Mail Attachment
• XSD File is not showing all the data fie

Recommend Articles

• Do you have to have Office installed?
• Referencing a VSTO Office Project (Word
• Comments color in Word
• Referencing Office XP PIAs
• Loadbehaviour changes automatically from
• Accessing Excel Files in different versi
• Validated data entry in Excel
• Freeze Pane in VSTO2005
• Xml Toolbox issue
• adding a table of content in a word docu
• Office Word 2003 custom property problem
• Package Wizard etc
• VSTO add-in setup error accessing registry
• Outlook AddIn Install On User Machine Fa
• VSTO SE, Vista RC2, Caspol, Oh My