Office.SmartAlertsEventCompletedOptions interface

指定 智能警报加载项 在完成处理 OnMessageSendOnAppointmentSend 事件时的行为。

注解

[ API set: Mailbox 1.12 ]

Outlook) 的最低权限级别 (受限

适用的 Outlook 模式:撰写

示例

// The following example checks whether a location is specified in an appointment before it's sent.
function onAppointmentSendHandler(event) {
    Office.context.mailbox.item.location.getAsync({ asyncContext: event }, asyncResult => {
        const event = asyncResult.asyncContext;
        if (asyncResult.status === Office.AsyncResultStatus.Failed) {
            console.log(asyncResult.error.message);
            // If the add-in is unable to retrieve the appointment's location, the appointment isn't sent.
            event.completed({ allowEvent: false, errorMessage: "Failed to get the appointment's location." });
            return;
        }

        if (asyncResult.value === "") {
            // If no location is specified, the appointment isn't sent and the user is alerted to include a location.
            event.completed(
                {
                    allowEvent: false,
                    cancelLabel: "Add a location",
                    commandId: "msgComposeOpenPaneButton",
                    contextData: JSON.stringify({ a: "aValue", b: "bValue" }),
                    errorMessage: "Don't forget to add a meeting location.",
                    errorMessageMarkdown: `
                        Don't forget to add a meeting location.\n\n
                        **Tip**: For a list of locations,
                        see [Meeting Locations]("https://www.contoso.com/meeting-locations).`,
                    sendModeOverride: Office.MailboxEnums.SendModeOverride.PromptUser
                }
            );
        } else {
            // If a location is specified, the appointment is sent.
            event.completed({ allowEvent: true });
        }
    });
}

属性

allowEvent

使用 completed 方法 指示事件处理程序完成时,此值指示处理的事件应继续执行还是取消。 例如,处理 OnMessageSendOnAppointmentSend 事件的外接程序可以设置为 allowEventfalse 以取消项目发送。 有关完整示例,请参阅 智能警报演练

errorMessage

使用 completed 方法 发出事件处理程序完成信号并将其属性设置为 allowEventfalse时,此属性将设置将向用户显示的错误消息。 有关示例,请参阅 智能警报演练

属性详细信息

allowEvent

使用 completed 方法 指示事件处理程序完成时,此值指示处理的事件应继续执行还是取消。 例如,处理 OnMessageSendOnAppointmentSend 事件的外接程序可以设置为 allowEventfalse 以取消项目发送。 有关完整示例,请参阅 智能警报演练

allowEvent?: boolean;

属性值

boolean

注解

[ API set: Mailbox 1.12 ]

Outlook) 的最低权限级别 (受限

适用的 Outlook 模式:撰写

errorMessage

使用 completed 方法 发出事件处理程序完成信号并将其属性设置为 allowEventfalse时,此属性将设置将向用户显示的错误消息。 有关示例,请参阅 智能警报演练

errorMessage?: string;

属性值

string

注解

[ API set: Mailbox 1.12 ]

Outlook) 的最低权限级别 (受限

适用的 Outlook 模式:撰写