-1

I'm calling Office.context.ui.displayDialogAsync() in a word add-in. The dialog displays the message "ADD-IN ERROR The add-in could not be started. Please restart all Office applications and try again." But the displayDialogAsync() callback gives the succeeded status.

The page is a https URL with the same domain. (I'm testing on localhost.)

I can open the same URL with window.open() so I know the page exist.

Anyone knows what could be the reason for the error message, or how to get better diagnostics?

JacquesB
  • 41,662
  • 13
  • 71
  • 86

1 Answers1

0

If you specified callback when calling the displayDialogAsync method, you may check result.error.code and result.error.message. As soon as you know what the actual error is, you can start troubleshooting, for example:

var dialog;
Office.context.ui.displayDialogAsync('https://myDomain/myDialog.html',
   function (asyncResult) {
       if (asyncResult.status === Office.AsyncResultStatus.Failed) {
            showNotification(asyncResult.error.code = ": " + asyncResult.error.message);
       } else {
            dialog = asyncResult.value;
            dialog.addEventHandler(Office.EventType.DialogMessageReceived, processMessage);
      }
});

Check out the Handle errors and events in the Office dialog box for well-known errors.

Also you may find the Troubleshoot development errors with Office Add-ins page helpful.

Also make sure that the Protected mode is turned off in Windows.

In Windows 11, Protected Mode settings are missing in Internet Options, but you still can modify them via registry editor. These settings are stored in HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones. Under Zones is a subkey for each zone, named numerically:

0 is the Local Machine zone
1 is the Intranet zone
2 is the Trusted Sites zone
3 is the Internet zone
4 is the Restricted Sites zone

Under each numerically-named key, you can create or set a REG_DWORD value named 2500 to control whether Protected Mode is enabled for the zone. Setting that value to 0 enables Protected Mode; a setting of 3 disables it.

So, to disable Protected Mode for the Internet zone, set this entry to 3:

 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\2500
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45