Office.Dialog interface

The object that is returned when UI.displayDialogAsync is called. It exposes methods for registering event handlers and closing the dialog.

Remarks

Requirement set: DialogAPI

Methods

addEventHandler(eventType, handler)

Registers an event handler. The two supported events are:

  • DialogMessageReceived. Triggered when the dialog box sends a message to its parent.

  • DialogEventReceived. Triggered when the dialog box has been closed or otherwise unloaded.

close()

Called from a parent page to close the corresponding dialog box.

messageChild(message)

Delivers a message from the host page, such as a task pane or a UI-less function file, to a dialog that was opened from the page.

sendMessage(name)

FOR INTERNAL USE ONLY. DO NOT CALL IN YOUR CODE.

Method Details

addEventHandler(eventType, handler)

Registers an event handler. The two supported events are:

  • DialogMessageReceived. Triggered when the dialog box sends a message to its parent.

  • DialogEventReceived. Triggered when the dialog box has been closed or otherwise unloaded.

addEventHandler(eventType: Office.EventType, handler: Function): void;

Parameters

eventType
Office.EventType
handler
Function

Returns

void

close()

Called from a parent page to close the corresponding dialog box.

close(): void;

Returns

void

messageChild(message)

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.

Delivers a message from the host page, such as a task pane or a UI-less function file, to a dialog that was opened from the page.

messageChild(message: string): void;

Parameters

message
string

Accepts a message from the host page to deliver to the dialog. Anything that can be serialized to a string, including JSON and XML, can be sent.

Returns

void

Remarks

Requirement set: TBD

sendMessage(name)

FOR INTERNAL USE ONLY. DO NOT CALL IN YOUR CODE.

sendMessage(name: string): void;

Parameters

name
string

Returns

void