MicrosoftAjax.js is not loaded successfully inside Office application
Asked Answered
J

0

3

I was using the CDN release of office-js, but had to change to a local version. After this change, it seems Office.initialize is not being run, which means the add-in doesn't work correctly. On the console, I see the following error:

SCRIPT5022: MicrosoftAjax.js is not loaded successfully.
office.js (18,26767)

The only references to MicrosoftAjax.js that I can find are ASP.NET related, but my project is Typescript/React. Here's how office.js is being loaded in the html:

<!doctype html>
<html lang="en" data-framework="typescript">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>wincross-formatter</title>
</head>

<body class="ms-font-m">
  <script src="/assets/office.js"></script>
  <div id="container"></div>
</body>

</html>

How can I fix this error?

EDIT:

As per this page, I added the following line just above the office-js script:

<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>

Adding it after the office-js script gives me this error instead of the previous one, and Office.initialize still isn't being called:

SCRIPT5022: Neither the locale, en-us, provided by the host app nor the fallback locale en-us are supported.

FINAL EDIT: That was completely my fault. I didn't copy the contents of office-js/dist recursively.

Jasisa answered 11/4, 2019 at 11:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.