Answered Current Outlook user && Active Directory

  • Thursday, December 01, 2011 2:03 PM
     
     
    How to get active directory info with current Outlook user?

All Replies

  • Thursday, December 01, 2011 2:09 PM
     
     

    What kind of info?

    Have you tried the Application.Session.CurrentUser property?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
  • Thursday, December 01, 2011 2:27 PM
     
     

    Have you tried the Application.Session.CurrentUser property?

    Yes. But I get Recipient

    What kind of info?

    I need domain user name.
  • Thursday, December 01, 2011 2:35 PM
     
     

    Try Recipient.AddressEntry.GetExchangeUser.Alias

    Be prepared to handle situations when AddressEntry.GetExchangeUser returns null.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
  • Thursday, December 01, 2011 2:48 PM
     
     

    Try Recipient.AddressEntry.GetExchangeUser.Alias

    Alias consist of only user name without domain name.
  • Thursday, December 01, 2011 6:36 PM
     
     Answered

    Yes, Outlook only returns the contents of the PR_ACCOUNT property, which only contains the login name.

    You can either use MAPI (C++ or Delphi) to retrieve the PR_EMS_AB_ASSOC_NT_ACCOUNT property and use it to call LookupAccountSid() or use Redemption, which exposes the RDOAddressEntry.NTAccountName property:

      set Session = CreateObject("Redemption.RDOSession")
      Session.MAPIOBJECT = Application.Session.MAPIOBJECT
      MsgBox Session.CurrentUser.NTAccountName

     


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!