locked
[EWS 2007] Retrieve current user email address. RRS feed

  • Question

  • Hi all,

    We're building a Javascript frontend that interact with the EWS directly. Since user is authenticated via NTLM (browser), the Javscript do not aware the username and password. I am wondering if there are any way we get retrieve user's email address after authenticated in EWS?

     

    Wednesday, September 14, 2011 6:53 AM

Answers

All replies

  • If you want to know the SMTP address of the Mailbox your accessing you can get this using the PR_STORE_ENTRYID  eg http://social.technet.microsoft.com/Forums/en-AU/exchangesvrdevelopment/thread/7abead8c-1650-4965-9cd1-179f465cf579 . For the actual username of the user running the code eg if this is an asp page then you would use something like
    WindowsPrincipal winPrincipal = (WindowsPrincipal)HttpContext.Current.User;

     http://msdn.microsoft.com/en-us/library/ff647076.aspx

    Cheers
    Glen

    • Marked as answer by Camv60 Thursday, September 15, 2011 6:36 AM
    Thursday, September 15, 2011 3:27 AM
  • Have never came across a direct method that gives email-address of logged in user, but you can do simple hack by creating a PostItem and then getting email-address by its PostItem.getFrom() method, something like :

        PostItem postItem = new PostItem( service );
        postItem.setBody( MessageBody.getMessageBodyFromText("Test for email-address " ) );
        postItem.save();
    
        postItem = PostItem.bind( service , postItem.getId() ); 
        System.out.println( postItem.getFrom() );
    
        postItem.delete( DeleteMode.HardDelete );
    Tuesday, December 17, 2013 9:57 AM