Office.Urls interface

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

Remarks

[ API set: Mailbox 1.14 ]

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

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

javascriptRuntimeUrl: string;

Property Value

string

Remarks

[ API set: Mailbox 1.14 ]

Minimum permission level: restricted

Applicable Outlook mode: Compose or Read

Important:

  • The URL that's returned points to the location of the JavaScript file that classic 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.

  • In Outlook on the web and new Outlook on Windows, this API isn't supported in add-ins that implement a task pane. On these clients, the API is only supported in add-ins that implement event-based activation or integrated spam reporting.

  • 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, the URL returned matches the value of the script property in the "extensions.runtimes.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]}`);