Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 968
Alex Patel Avatar asked Oct 18 '22 20:10

Alex Patel


1 Answers

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.

like image 133
Dai Avatar answered Oct 20 '22 09:10

Dai