Search code examples
exchangewebservicesews-managed-api

How get the current user's own email address or check entered, using Exchange Web Services (EWS)?


I have to work with external Exchange server. How can I get the own email address or check address entered by the user (that he introduced exactly own address), using EWS? Email address is not the same as username.


Solution

  • The best solution at this moment.

    You can use ConvertId with a generic address and Exchange will then return the PrimarySMTP for that mailbox eg.

    Folder Inbox = Folder.Bind(service, WellKnownFolderName.Inbox);
    AlternateId aiAlternateid = new AlternateId(IdFormat.EwsId, Inbox.Id.UniqueId, "mailbox@domain.com");
    AlternateIdBase aiResponse = service.ConvertId(aiAlternateid, IdFormat.EwsId);
    Console.WriteLine(((AlternateId)aiResponse).Mailbox);