Share via


Office.SmartAlertsEventCompletedOptions interface

または OnAppointmentSend イベントの処理が完了したときのスマート アラート アドインの動作をOnMessageSend指定します。

注釈

// 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.",
                    sendModeOverride: Office.MailboxEnums.SendModeOverride.PromptUser
                }
            );
        } else {
            // If a location is specified, the appointment is sent.
            event.completed({ allowEvent: true });
        }
    });
}

プロパティ

allowEvent

完了したメソッドを使用してイベント ハンドラーの完了を通知する場合、この値は、処理されたイベントが実行を続行するか、取り消されるかを示します。 たとえば、 または OnAppointmentSend イベントを処理するアドインを OnMessageSendfalse設定allowEventすると、アイテムの送信を取り消すことができます。 完全なサンプルについては、 スマート アラートのチュートリアルを参照してください。

errorMessage

完了したメソッドを使用してイベント ハンドラーの完了を通知し、そのプロパティを allowEventfalse設定すると、このプロパティは、ユーザーに表示されるエラー メッセージを設定します。 例については、 スマート アラートのチュートリアルを参照してください。

プロパティの詳細

allowEvent

完了したメソッドを使用してイベント ハンドラーの完了を通知する場合、この値は、処理されたイベントが実行を続行するか、取り消されるかを示します。 たとえば、 または OnAppointmentSend イベントを処理するアドインを OnMessageSendfalse設定allowEventすると、アイテムの送信を取り消すことができます。 完全なサンプルについては、 スマート アラートのチュートリアルを参照してください。

allowEvent?: boolean;

プロパティ値

boolean

注釈

[ API セット: メールボックス 1.12 ]

最小アクセス許可レベル (Outlook): 制限あり

適用できる Outlook モード: 新規作成

errorMessage

完了したメソッドを使用してイベント ハンドラーの完了を通知し、そのプロパティを allowEventfalse設定すると、このプロパティは、ユーザーに表示されるエラー メッセージを設定します。 例については、 スマート アラートのチュートリアルを参照してください。

errorMessage?: string;

プロパティ値

string

注釈

[ API セット: メールボックス 1.12 ]

最小アクセス許可レベル (Outlook): 制限あり

適用できる Outlook モード: 新規作成