Share via

Outlook Classic restricts Office.js network access

Aron Marinescu 0 Reputation points
2026-02-27T14:25:16.4066667+00:00

Hello,

I am currently working on a Outlook add-in that applies the signature at the end of the body when the user starts composing an email or replies to another email.

Currently I have two javascript files, one is the taskpane.js and the other is the command.js file. Both of these make an API call to retrieve the current user's signatures (in HTML format).
The taskpane.js file is supposed to run when the user explicitly opens the application from the ribbon. The command.js file should run in the background.

Inside my manifest.xml I have the following values (frontend and backend values are placeholders):

1. Runtimes

<Runtimes>
  <Runtime resid="WebViewRuntime.Url">
    <Override type="javascript" resid="JSRuntime.Url" />
  </Runtime>
</Runtimes>

2. AppDomains

<AppDomains>
  <AppDomain>__FRONTEND_BASE_URL__</AppDomain>
  <AppDomain>__BACKEND_API_URL__</AppDomain>
</AppDomains>

3. LaunchEvent ExtensionPoint (Desktop)

<ExtensionPoint xsi:type="LaunchEvent">
  <LaunchEvents>
    <LaunchEvent Type="OnNewMessageCompose" FunctionName="onNewMessageCompose" />
    <LaunchEvent Type="OnMessageRecipientsChanged"
      FunctionName="onMessageRecipientsChanged" />
  </LaunchEvents>
  <SourceLocation resid="WebViewRuntime.Url" />
</ExtensionPoint>

4. Relevant Resource URLs

<bt:Url id="WebViewRuntime.Url"
  DefaultValue="__FRONTEND_BASE_URL__/commands.html" />
<bt:Url id="JSRuntime.Url"
  DefaultValue="__FRONTEND_BASE_URL__/commands.js" />

5. Permissions

<Permissions>ReadWriteItem</Permissions>

On Outlook Web, both the taskpane and the command scripts work fine, but on Outlook Classic only the taskpane can execute network calls.

Initially, when using the fetch() function, this error was returned: The request does not meet the requirements for Same-Origin policy or Simple Cross-Origin resource sharing.

So I proceeded to setup my .well-know/microsoft-officeaddins-allowed.json as this:

{
	"allowed": [
		"__FRONTEND_BASE_URL__/command.js"
	]
}

When monitoring network requests with Fiddle, I saw that Outlook classic successfully requested and downloaded the microsoft-officeaddins-allowed.json file.

After restarting Outlook classic, the command.js file gave me this error: A connection with the server could not be established.
Also, I noticed (by watching Fiddle logs) that the requests made by the command.js never leaved the machine.

I'm wondering if there is a way to give the background script network access in order to execute API calls.
Thank!

Microsoft 365 and Office | Development | Office JavaScript API
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Kudos-Ng 14,515 Reputation points Microsoft External Staff Moderator
    2026-02-27T15:35:31.83+00:00

    Hi Aron Marinescu,

    Thank you for posting your question in the Microsoft Q&A forum.

    After researching this, I found many developers have reported the same behavior in Classic Outlook. The recurring explanation is the runtime difference, specifically: In classic Outlook on Windows, the LaunchEvent code runs in a JavaScript-only runtime instead of a webview browser control, which is why behavior differs from Outlook on the web (and from taskpane code).

    However, Microsoft documents that the JavaScript-only runtime can request external data, but if your add-in operates in that runtime, you must use absolute URLs in fetch() calls because relative URLs aren’t supported there.

    Reference: https://learn.microsoft.com/en-us/office/dev/add-ins/testing/runtimes

    I hope the information above helpful.


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.