none
Message parent is not working from dialog on Outlook web add in. RRS feed

  • Question

  • I created a dialog on my outlook addin using the dialog api.

    But nothing is working on calling `Office.context.ui.messageParent("success")`. The host page is in typescript angular
    and the dialog box is plain html and javascript. I am not getting any error. The host and the dialog page are on the same domain.

    This is how I created the dialog

        startDialog() {
            try {
              Office.context.ui.displayDialogAsync(
                `${window.location.origin}/dialog`,
                {
                  height: 60,
                  width: 80,
                  displayInIframe: false,
                },
                function (asyncResult) {
                  console.info("Dialog window opened for authentication");
                  console.info(asyncResult);
                  asyncResult.value.close();
                  asyncResult.value.addEventHandler(
                    Office.EventType.DialogEventReceived,
                    (message) => {
                      console.info(message);
                      console.info("MESSAGE received from dialog");
                      asyncResult.value.close();
                      this.router.navigate(["/sucessScreen"]);
                      this.userExist = true;
                      localStorage.setItem("auth", JSON.stringify(this.userExist));
                    }
                  );
                }
              );
            } catch (error) {
              console.error("Error setting up dialog");
              console.error(error);
            }
          }

    The page in the dialog is

        <!DOCTYPE html>
        <html lang="en">
          <head>
            <meta charset="UTF-8" />
            <meta name="viewport" content="width=device-width, initial-scale=1.0" />
            <title>Sustainable Meeting Activated Successfully</title>
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
            <script src="https://appsforoffice.microsoft.com/lib/beta/hosted/office.debug.js"></script>
            <script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js"></script>
            <link
              rel="stylesheet"
              href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.4.0/css/fabric.min.css"
            />
            <link
              rel="stylesheet"
              href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.4.0/css/fabric.components.min.css"
            />
            <script src="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.4.0/js/fabric.min.js"></script>
          </head>
          <body>
            <script>
              (function () {
                console.info("Test Dialog");
                Office.initialize = (reason) => {
                  $(document).ready(function () {
                    Office.context.ui.messageParent(true);
                  });
                };
              })();
            </script>
          </body>
        </html>


    There's no error when I message the parent. The host callback function on the host page couldn't simply receive the message. I did everything according to the documentation.

    Sunday, June 7, 2020 1:06 PM

All replies

  • Any ideas on this? I'm also seeing the same issue and am completely stuck. There is no error, but the message never arrives at the parent.  This is in OWA on Chrome and Edge (latest - Chromium).
    Thursday, June 25, 2020 12:38 PM
  • Did you manage to solve this problem? I'm facing the same problem!

    Wednesday, July 8, 2020 12:26 PM