Office.MailboxEnums.SendModeOverride enum

注意

此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。

指定在运行时替代清单中设置的选项的 发送模式选项

有关如何实现智能警报加载项的信息,请参阅使用智能警报处理 Outlook 外接程序中的 OnMessageSend 和 OnAppointmentSend 事件

注解

[ API 集:邮箱预览 ]

适用的 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",
                    errorMessage: "Don't forget to add a meeting location.",
                    sendModeOverride: Office.MailboxEnums.SendModeOverride.PromptUser
                }
            );
        } else {
            // If a location is specified, the appointment is sent.
            event.completed({ allowEvent: true });
        }
    });
}

字段

PromptUser = "promptUser"

当邮件项不符合基于事件的加载项的条件时,在智能警报对话框中提供“ 仍然发送 ”选项。 若要了解详细信息,请参阅 提示用户 发送模式选项