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
Minimum permission level: restricted
Applicable Outlook mode: Compose or Read
Properties
javascript |
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
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 typejavascript
. 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]}`);
Office Add-ins
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for