Locally debugging Office Add-ins errors with “We can’t open this add-in from localhost”

When developing an office add-in, some times my local development environment causes issue when attempting to work with Windows Desktop versions of Office (Outlook, Word, Excel, PowerPoint). What could be working one day will tomorrow have Office saying “We can’t open this add-in from localhost”.

We can’t open this add-in from localhost. Click “See Details” for more information.

There are two things you may need to do:

  • Enable local loop-backs
  • Install and allow the self-signed certificate

Enable local loopbacks

Edge Web Viewer will need to allow loop-backs. To do this, open PowerShell as an Administrator, and run the following:

CheckNetIsolation LoopbackExempt -a -n="microsoft.win32webviewhost_cw5n1h2txyewy"

Install and trust the self-signed certificate

Previously I have written how to run an Angular app locally over HTTPS, which relies on a self-signed certificate. Problem is, browsers don’t trust self-signed certificates and Outlook will not trust your app running over HTTPS locally.

The self-signed certificate needs to be trusted though installation.

Open Internet Explorer (Start, “iexplore”, Enter), and go to the URL of your app, you should see something similar to:

This site is not secure. Error Code DLG_FLAGS_INVALID_CA

Clicking on the not recommended “Go on to the webpage” so you can see your site with a Certificate Error. Click on the error and then “View certificates”.

The self-signed certificate will appear, click “Install certificate” to bring on the Certificate Import Wizard.

Install the certificate to the Trusted Root Certification Authorities. Then next next next to complete the wizard.

Close IE, restart Outlook, and you should be right to roll!

As I said earlier, this happens to me every now and then, and I believe it is to be due to the self-signed certificate being regenerated and is no longer trusted. As it takes me way too long each time to remember what I have done previously, I have documented what I will need to do next time.

Comments are closed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: