Skip to content

Instantly share code, notes, and snippets.

@eirikb
Created January 27, 2020 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eirikb/2519feacd278ada721e5141a37e166b8 to your computer and use it in GitHub Desktop.
Save eirikb/2519feacd278ada721e5141a37e166b8 to your computer and use it in GitHub Desktop.
const isOutlookNative = Office.context.mailbox && Office.context.mailbox.diagnostics.hostName === 'Outlook';
if (isOutlookNative) {
msal.openPopup = () => {
const dummy = {
close() {
},
location: {
assign(url) {
Office.context.ui.displayDialogAsync(url, { width: 25 }, res => {
dummy.close = res.value.close;
res.value.addEventHandler(Office.EventType.DialogMessageReceived, ({ message }) =>
dummy.location.href = dummy.location.hash = message
);
});
}
}
};
return dummy;
};
const { hash } = window.location;
if (msal.isCallback(hash)) {
Office.context.ui.messageParent(hash);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment