Search code examples
office-jsword-addins

How to use `Word.run(function (context) {` in Office `Dialog API`


I am developing with Word AddIn, I want to use Word.run(function (context) { in Dialog API, but I always get exception general exception with internal server error. There is no additional message.

Error:

Debug info: {"code":"GeneralException","message":"An internal error has occurred."}


Solution

  • You can't use Word.run inside the dialog.

    The messageParent function is one of only two Office APIs that can be called in the dialog box. The other is Office.context.requirements.isSetSupported. The messageParent function can only be called on a page with the same domain (including protocol and port) as the host page.

    I got this info from the documentation: Use the Dialog API