Office.SpamReportingEventCompletedOptions interface

指定 集成垃圾邮件报告加载项 在完成处理 SpamReporting 事件后的行为。

注解

[ API set: Mailbox 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

使用 completed 方法 指示报告的邮件已完成处理时,此属性指定邮件将移动到的 Outlook 邮箱文件夹。

moveItemTo

使用 completed 方法 指示报告的邮件已完成处理时,此属性指定是否将邮件移动到邮箱中的其他文件夹。

onErrorDeleteItem

如果设置为 true,则在处理消息时发生错误,则删除报告的消息。 如果此属性设置为 false 或未在 completed 方法中指定,则报告的邮件将保留在其当前邮箱文件夹中。

postProcessingAction

使用 completed 方法 指示报告的邮件已完成处理时,此属性指定是否将邮件移动到邮箱中的其他文件夹。 以下后处理操作可用。

  • delete - 将报告的邮件移动到邮箱的 “已删除邮件” 文件夹。

  • moveToCustomFolder - 将报告的邮件移动到指定的文件夹。 必须在 属性中 folderName 指定文件夹的名称。

  • moveToSpamFolder- 将报告的邮件移动到邮箱的“垃圾邮件Email”文件夹。

  • noMove - 将报告的邮件保留在其当前文件夹中。

showPostProcessingDialog

使用 completed 方法 指示报告的消息已完成处理时,此属性指示是否向用户显示后期处理对话框。 分配给此属性的 JSON 对象必须包含标题和说明。 如果未指定此属性,则处理用户报告的消息后,不会向用户显示对话框。

属性详细信息

folderName

使用 completed 方法 指示报告的邮件已完成处理时,此属性指定邮件将移动到的 Outlook 邮箱文件夹。

folderName?: string;

属性值

string

注解

[ API set: Mailbox 1.14 ]

最低权限级别 (Outlook) read item

适用的 Outlook 模式:邮件读取

重要说明

  • 如果指定的文件夹尚不存在,则会在邮件移动之前创建该文件夹。

  • 如果属性 postProcessingAction 设置为 moveToCustomFolder,则必须指定 属性 folderName 。 否则,报告的邮件将移动到邮箱的“垃圾邮件Email”文件夹中。 如果 postProcessingAction 设置为以外的 moveToCustomFolder其他操作,则忽略 属性 folderName

moveItemTo

使用 completed 方法 指示报告的邮件已完成处理时,此属性指定是否将邮件移动到邮箱中的其他文件夹。

moveItemTo?: MailboxEnums.MoveSpamItemTo;

属性值

注解

[ API set: Mailbox 1.14 ]

最低权限级别 (Outlook) read item

适用的 Outlook 模式:邮件读取

重要说明

  • 你只能在 Outlook 网页版 中的垃圾邮件报告加载项中使用此属性,该加载项在 Windows (上,从版本 2308 (内部版本 16724.10000) ) 开始,在 Mac 上,以及新的 Outlook on Windows (预览版) 。 如果你使用的是支持集成垃圾邮件报告功能的 Outlook on Windows 中的早期版本,请改用 postProcessingAction 属性。

  • 如果 属性设置为 Office.MailboxEnums.MoveSpamItemTo.CustomFolder,则必须在调用的 属性event.completedfolderName指定要将邮件移动到的文件夹的名称。 否则, moveItemTo 属性将默认为 Office.MailboxEnums.MoveSpamItemTo.JunkFolder ,并将报告的邮件移动到 “垃圾邮件Email” 文件夹。

onErrorDeleteItem

如果设置为 true,则在处理消息时发生错误,则删除报告的消息。 如果此属性设置为 false 或未在 completed 方法中指定,则报告的邮件将保留在其当前邮箱文件夹中。

onErrorDeleteItem?: boolean;

属性值

boolean

注解

[ API set: Mailbox 1.14 ]

最低权限级别 (Outlook) read item

适用的 Outlook 模式:邮件读取

postProcessingAction

使用 completed 方法 指示报告的邮件已完成处理时,此属性指定是否将邮件移动到邮箱中的其他文件夹。 以下后处理操作可用。

  • delete - 将报告的邮件移动到邮箱的 “已删除邮件” 文件夹。

  • moveToCustomFolder - 将报告的邮件移动到指定的文件夹。 必须在 属性中 folderName 指定文件夹的名称。

  • moveToSpamFolder- 将报告的邮件移动到邮箱的“垃圾邮件Email”文件夹。

  • noMove - 将报告的邮件保留在其当前文件夹中。

postProcessingAction?: string;

属性值

string

注解

[ API set: Mailbox 1.14 ]

最低权限级别 (Outlook) read item

适用的 Outlook 模式:邮件读取

重要说明

  • 在 Outlook on Windows 中,只能在支持集成垃圾邮件报告功能的早期版本中使用此属性。 如果使用版本 2308 (内部版本 16724.10000) 或更高版本,请改用 moveItemTo 属性。

  • Outlook 网页版、Mac 或 Windows (预览版的新 Outlook) 不支持此属性。 moveItemTo请改用 属性。

  • 如果 属性设置为 moveToCustomFolder,则必须在调用的 属性event.completedfolderName指定要将邮件移动到的文件夹的名称。 否则, postProcessingAction 属性将默认为 moveToSpamFolder ,并将报告的邮件移动到 “垃圾邮件Email” 文件夹。

示例

// 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

使用 completed 方法 指示报告的消息已完成处理时,此属性指示是否向用户显示后期处理对话框。 分配给此属性的 JSON 对象必须包含标题和说明。 如果未指定此属性,则处理用户报告的消息后,不会向用户显示对话框。

showPostProcessingDialog?: object;

属性值

object

注解

[ API set: Mailbox 1.14 ]

最低权限级别 (Outlook) read item

适用的 Outlook 模式:邮件读取

重要提示:在Outlook 网页版或新的 Outlook on Windows (预览版) 中,加载项完成处理报告邮件后,不会显示后处理对话框。 即使 showPostProcessingDialog 已配置,这一点也适用。 但是,根据在呼叫中event.completed配置 moveItemTo 属性的方式,将显示一条通知,以指示何时删除报告的邮件或移动到邮箱中的另一个文件夹。 若要了解详细信息,请参阅 实现集成垃圾邮件报告加载项的“查看功能行为和限制”部分。