Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Specifies the ___location of code for the runtime. Based on runtime.type
, add-ins can use either a JavaScript file or an HTML page with an embedded script
tag that specifies the URL of a JavaScript file. Both URLs are necessary in situations where the runtime.type
is uncertain.
Properties that reference this object type:
Properties that reference this object type:
Syntax
Properties
page
Specifies the URL of the web page that contains an embedded script
tag, which specifies the URL of a JavaScript file (to be loaded in a browser-based runtime).
This property is localizable. For more information, see the localization schema.
Type
string
Required
✅
Constraints
Maximum string length: 2048.
Supported values
The string must start with https://
.
script
Specifies the URL of the JavaScript file to be loaded in JavaScript-only runtime.
This property is localizable. For more information, see the localization schema.
Type
string
Required
—
Constraints
Maximum string length: 2048.
Supported values
The string must start with https://
.
Remarks
The JavaScript in the file must initialize Office.js and define functions that take a single parameter: event. It should also call event.completed when it has finished execution. Functions in Outlook add-ins should use the notification APIs to indicate progress, success, or failure to the user.
Important
The call to event.completed
signals that the add-in has successfully handled the event. When a function is called multiple times, such as multiple clicks on the same add-in command, all events are automatically queued. The first event runs automatically, while the other events remain in the queue. When your function calls event.completed
, the next queued call to that function runs. You must call event.completed
; otherwise your function will not run.
Note
When the add-in is configured to use a shared runtime, the functions in the code file run in the same JavaScript runtime (and share a common global namespace) as the JavaScript in the add-in's task pane (if any).
Examples
{
"extensions": [
{
"runtimes": [
"code": {
"page": "https://contoso.com/events.html",
"script": "https://contoso.com/events.js"
}
]
}
]
}