次の方法で共有


Office.SpamReportingEventCompletedOptions interface

SpamReporting イベントの処理が完了した後の統合スパムレポート アドインの動作を指定します。

注釈

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

最小アクセス許可レベル: 読み取り項目

適用できる Outlook モード: メッセージの読み取り

// The following example handles a SpamReporting event to process a reported spam or phishing message.
function onSpamReport(event) {
    // Gets the Base64-encoded EML format of a reported message.
    Office.context.mailbox.item.getAsFileAsync({ asyncContext: event }, (asyncResult) => {
        if (asyncResult.status === Office.AsyncResultStatus.Failed) {
            console.log(`Error encountered during message processing: ${asyncResult.error.message}`);
            return;
        }

        // Run additional processing operations here.

        /**
        * Signals that the spam-reporting event has completed processing.
        * It then moves the reported message to a custom mailbox folder named "Reported Messages"
        * and shows a post-processing dialog to the user.
        * If an error occurs while the message is being processed, the `onErrorDeleteItem`
        * property determines whether the message will be deleted.
        */
        const event = asyncResult.asyncContext;
        event.completed({
            moveItemTo: Office.MailboxEnums.MoveSpamItemTo.CustomFolder,
            folderName: "Reported Messages",
            onErrorDeleteItem: true,
            showPostProcessingDialog: {
                title: "Contoso Spam Reporting",
                description: "Thank you for reporting this message.",
            },
        });
    });
}

プロパティ

folderName

完了したメソッドを使用して、報告されたメッセージの処理が完了したことを通知する場合、このプロパティは、メッセージの移動先となる Outlook メールボックス フォルダーを指定します。

moveItemTo

完了したメソッドを使用して、報告されたメッセージの処理が完了したことを通知する場合、このプロパティは、メッセージをメールボックス内の別のフォルダーに移動するかどうかを指定します。

onErrorDeleteItem

true に設定すると、メッセージの処理中にエラーが発生した場合に報告されたメッセージを削除します。 このプロパティが false に設定されているか、完了したメソッドで指定されていない場合、報告されたメッセージは現在のメールボックス フォルダーに残ります。

postProcessingAction

完了したメソッドを使用して、報告されたメッセージの処理が完了したことを通知する場合、このプロパティは、メッセージをメールボックス内の別のフォルダーに移動するかどうかを指定します。 次の後処理アクションを使用できます。

  • delete - 報告されたメッセージをメールボックスの [削除済みアイテム] フォルダーに移動します。

  • moveToCustomFolder - 報告されたメッセージを指定したフォルダーに移動します。 folderName プロパティでフォルダーの名前を指定する必要があります。

  • moveToSpamFolder - 報告されたメッセージをメールボックスの 迷惑メール フォルダーに移動します。

  • noMove - 報告されたメッセージを現在のフォルダーに残します。

showPostProcessingDialog

完了したメソッドを使用して、報告されたメッセージの処理が完了したことを通知すると、このプロパティは、後処理ダイアログがユーザーに表示されるかどうかを示します。 このプロパティに割り当てられた JSON オブジェクトには、タイトルと説明が含まれている必要があります。 このプロパティが指定されていない場合、報告されたメッセージが処理されると、ダイアログはユーザーに表示されません。

プロパティの詳細

folderName

完了したメソッドを使用して、報告されたメッセージの処理が完了したことを通知する場合、このプロパティは、メッセージの移動先となる Outlook メールボックス フォルダーを指定します。

folderName?: string;

プロパティ値

string

注釈

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

最小アクセス許可レベル (Outlook): アイテムの読み取り

適用できる Outlook モード: メッセージの読み取り

重要:

  • 指定したフォルダーがまだ存在しない場合は、メッセージが移動される前に作成されます。

  • postProcessingAction プロパティが moveToCustomFolder に設定されている場合は、folderName プロパティを指定する必要があります。 それ以外の場合、報告されたメッセージはメールボックスの 迷惑メール フォルダーに移動されます。 postProcessingActionmoveToCustomFolder以外の別のアクションに設定されている場合、folderName プロパティは無視されます。

moveItemTo

完了したメソッドを使用して、報告されたメッセージの処理が完了したことを通知する場合、このプロパティは、メッセージをメールボックス内の別のフォルダーに移動するかどうかを指定します。

moveItemTo?: MailboxEnums.MoveSpamItemTo;

プロパティ値

注釈

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

最小アクセス許可レベル (Outlook): アイテムの読み取り

適用できる Outlook モード: メッセージの読み取り

重要:

  • このプロパティは、Outlook on the web、Windows (バージョン 2308、ビルド 16724.10000 以降) および Mac のスパムレポート アドインでのみ使用できます。 統合されたスパムレポート機能をサポートする従来の Outlook on Windows の以前のビルドを使用している場合は、代わりに postProcessingAction プロパティを使用します。

  • プロパティが Office.MailboxEnums.MoveSpamItemTo.CustomFolder に設定されている場合は、event.completed呼び出しの folderName プロパティでメッセージを移動するフォルダーの名前を指定する必要があります。 それ以外の場合、 moveItemTo プロパティは既定で Office.MailboxEnums.MoveSpamItemTo.JunkFolder し、報告されたメッセージを 迷惑メール フォルダーに移動します。

onErrorDeleteItem

true に設定すると、メッセージの処理中にエラーが発生した場合に報告されたメッセージを削除します。 このプロパティが false に設定されているか、完了したメソッドで指定されていない場合、報告されたメッセージは現在のメールボックス フォルダーに残ります。

onErrorDeleteItem?: boolean;

プロパティ値

boolean

注釈

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

最小アクセス許可レベル (Outlook): アイテムの読み取り

適用できる Outlook モード: メッセージの読み取り

postProcessingAction

完了したメソッドを使用して、報告されたメッセージの処理が完了したことを通知する場合、このプロパティは、メッセージをメールボックス内の別のフォルダーに移動するかどうかを指定します。 次の後処理アクションを使用できます。

  • delete - 報告されたメッセージをメールボックスの [削除済みアイテム] フォルダーに移動します。

  • moveToCustomFolder - 報告されたメッセージを指定したフォルダーに移動します。 folderName プロパティでフォルダーの名前を指定する必要があります。

  • moveToSpamFolder - 報告されたメッセージをメールボックスの 迷惑メール フォルダーに移動します。

  • noMove - 報告されたメッセージを現在のフォルダーに残します。

postProcessingAction?: string;

プロパティ値

string

注釈

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

最小アクセス許可レベル (Outlook): アイテムの読み取り

適用できる Outlook モード: メッセージの読み取り

重要:

  • Outlook on Windows では、このプロパティは、統合されたスパムレポート機能をサポートする以前のビルドでのみ使用できます。 バージョン 2308 (ビルド 16724.10000) 以降の場合は、代わりに moveItemTo プロパティを使用します。

  • このプロパティは、Outlook on the web、Mac、または新しい Outlook on Windows ではサポートされていません。 代わりに moveItemTo プロパティを使用します。

  • プロパティが moveToCustomFolder に設定されている場合は、event.completed呼び出しの folderName プロパティでメッセージを移動するフォルダーの名前を指定する必要があります。 それ以外の場合、 postProcessingAction プロパティは既定で moveToSpamFolder し、報告されたメッセージを 迷惑メール フォルダーに移動します。

// The following example handles a SpamReporting event to process a reported spam or phishing message.
function onSpamReport(event) {
    // Gets the Base64-encoded EML format of a reported message.
    Office.context.mailbox.item.getAsFileAsync({ asyncContext: event }, (asyncResult) => {
        if (asyncResult.status === Office.AsyncResultStatus.Failed) {
            console.log(`Error encountered during message processing: ${asyncResult.error.message}`);
            return;
        }

        // Run additional processing operations here.

        /**
        * Signals that the spam-reporting event has completed processing.
        * It then moves the reported message to the Junk Email folder of the mailbox and shows a
        * post-processing dialog to the user.
        */
        const event = asyncResult.asyncContext;
        event.completed({
            postProcessingAction: "moveToSpamFolder",
            showPostProcessingDialog: {
                title: "Contoso Spam Reporting",
                description: "Thank you for reporting this message.",
            },
        });
    });
}

showPostProcessingDialog

完了したメソッドを使用して、報告されたメッセージの処理が完了したことを通知すると、このプロパティは、後処理ダイアログがユーザーに表示されるかどうかを示します。 このプロパティに割り当てられた JSON オブジェクトには、タイトルと説明が含まれている必要があります。 このプロパティが指定されていない場合、報告されたメッセージが処理されると、ダイアログはユーザーに表示されません。

showPostProcessingDialog?: object;

プロパティ値

object

注釈

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

最小アクセス許可レベル (Outlook): アイテムの読み取り

適用できる Outlook モード: メッセージの読み取り