How to respond to a change in document mode in Office Javascript Word AddIn

Richard Sloggett 1 Reputation point
2021-02-01T17:10:25.2+00:00

We have a Word JavaScript AddIn that assists users with authoring content. The AddIn is only functional when a ReadWrite document is loaded so we check Office.context.document.mode to ensure it is "readWrite" when the AddIn starts up. That works as expected but if the file mode changes (e.g. the user checks out the file from SharePoint) the mode does not update - i.e. it still returns "readOnly". If we reload the AddIn the mode returns the expected value.

So my question is whether there is a way to force Office.context.document.mode to update to reflect the current document mode? Alternatively, is there some way to listen for document changes so we can automatically reload the AddIn?

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
886 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,536 questions
0 comments No comments
{count} votes