How to get User's actual Email Id in Outlook Add-in Integration

4.1k views Asked by At

I have integrated created one Add-In to be integrated in Outlook Mail.

I have used Office inbuilt code (Javascript Code) for it.

Now to test Add-in i have signup in Microsoft with my personal email id.After sign up i found that in Outlook Mail, there are two different Mail Ids in Profile.

like

  1. alex.p@***.com
  2. [email protected]

now i need the first one for validation but i am getting the second one every time.

I used below code for that.

 Office.initialize = function (reason) {
    item = Office.context.mailbox.item;
    console.log(Office.context.mailbox.userProfile.displayName);
    console.log(Office.context.mailbox.userProfile.emailAddress);
 }

Please suggest me some other way to get the users email id.

1

There are 1 answers

2
Dai On

The documentation for the Outlook JavaScript API ( https://dev.office.com/docs/add-ins/develop/understanding-the-javascript-api-for-office#mailbox-object ) implies that your code runs only within a mailbox context which only exposes that specific mailbox's data, so you cannot access any information about other mailboxes.

I had a quick search and I don't think it's possible to enumerate email addresses associated with a mailbox, nor information about other mailboxes in Desktop Outlook or whatever the OWA equivalent is.