Office.Urls interface

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Provides the URLs of the runtime environments used by an add-in.

Remarks

[ API set: Mailbox preview ]

Minimum permission level: restricted

Applicable Outlook mode: Compose or Read

Properties

javascriptRuntimeUrl

Gets the URL of the JavaScript runtime of an add-in.

Property Details

javascriptRuntimeUrl

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Gets the URL of the JavaScript runtime of an add-in.

javascriptRuntimeUrl: string;

Property Value

string

Remarks

[ API set: Mailbox preview ]

Minimum permission level: restricted

Applicable Outlook mode: Compose or Read

Important:

  • This property is currently in preview in Outlook on Windows. To test it in your add-in, you must install Version 2401 (Build 17228.20000) or later. Then, join the Microsoft 365 Insider program and select the Beta Channel option to access Office beta builds.

  • The URL returned points to the location of the JavaScript file that Outlook on Windows uses to handle event-based activation and integrated spam reporting. To learn more about these features, see Configure your Outlook add-in for event-based activation and Implement an integrated spam-reporting add-in (preview).

  • If your add-in uses the XML manifest, the URL returned matches the resid value of the RuntimeOverride element of type javascript. To learn more, see Override element for Runtime.

  • If your add-in uses the unified manifest for Microsoft 365 (developer preview), the URL returned matches the value of the script property in the "code" object.

Examples

// Get the value of the first parameter of the JavaScript runtime URL.
// For example, if the URL is https://wwww.contoso.com/training?key1=value1&key2=value2,
// the following function logs "First parameter value: value1" to the console.
const url = Office.context.urls.javascriptRuntimeUrl;
const regex = /=([^&]+)/;
console.log(`First parameter value: ${url.match(regex)[1]}`);