0

I am trying to create a dialog in my outlook add-in. I got this error from the browser console of the dialog while loading office scripts. The dialog contains a simple html page with jquery and office scripts references in the header.

TypeError: can't redefine non-configurable property "context" outlook-web-16.01.js:19:9756

ObjectOrReflectDefineProperty self-hosted:1762
    defineProperty self-hosted:1813
    defineNondefaultProperty https://appsforoffice.microsoft.com/lib/beta/hosted/outlook-web-16.01.js:19
    defineEnumerableProperty https://appsforoffice.microsoft.com/lib/beta/hosted/outlook-web-16.01.js:19
    <anonymous> https://appsforoffice.microsoft.com/lib/beta/hosted/outlook-web-16.01.js:19

This is the source code of the dialog page

<!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>

How can I resolve this issue?

4

1 回答 1

0

Include a single version of Office js.

Change

<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>

to

<script src="https://appsforoffice.microsoft.com/lib/beta/hosted/office.debug.js"></script>

or

<script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js"></script>
于 2020-06-09T04:36:45.790 回答