Search code examples
javascriptoutlookoutlook-addinoffice-jsoutlook-web-app

How do I display a message similar to Window.alert() in OfficeJS


I'm trying to display a custom message, but window.alert() is restricted in OfficeJS.

I have found a solution which suggests using app.showNotification(title, message);

Office.initialize = function (reason) {
        $(document).ready(function () {
             app.showNotification("Title For the Notification", "test");
    });
 });

Browser throws

"app is undefined error".

Which module am I missing ?


Solution

  • To answer on original question (in your title) you may use Fabric-UI Dialog API to achive this functionality. The examples of the options for available dialog's styles over here. You may use any other UI package as well ... JQuery UI, JQuery Mobile, etc.