问题
I tried to load Office.js to my application.
I've added the <script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js" type="text/javascript"></script>
and I get warning and error in console.
Warning: Office.js is loaded outside of Office client
and Error: o15apptofilemappingtable.js:11 GET https://telemetryservice.firstpartyapps.oaspapps.com/telemetryservice/telemetryproxy.html 404 (Not Found)
I created app.js contains:
Office.initialize = function (reason) {
$(document).ready(function () {
switch (reason) {
case 'inserted': console.log('The add-in was just inserted.');
case 'documentOpened': console.log('The add-in is already part of
the document.');
}
});
};
Someone can help me please how can I fix it?
Thanks!
回答1:
The first error is expected when you try to open the add-in in a browser page. Office.js will only work inside an Office application, such as in a task pane. To run an add-in that you are developing, you need to sideload it into an Office application. If you are working with Visual Studio, you can just press F5. If you are working with a different editor, you need to use one of the sideloading techniques. For details, see Sideload Office Add-ins for testing.
The second error is probably a side effect of the first one.
来源:https://stackoverflow.com/questions/49475805/office-api-javascript-loading-error-telemetryproxy-html-not-found