Office.MailboxEnums.MoveSpamItemTo enum

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Specifies the folder to which a reported spam or phishing message is moved once it's processed by a spam-reporting add-in.

To learn more about the integrated spam-reporting feature, see Implement an integrated spam-reporting add-in (preview).

Remarks

[ API set: Mailbox preview ]

Applicable Outlook mode: Message Read

Important: This enum can only be used to assign values to the moveItemTo property of the event.completed method. If you're on an Outlook on Windows version that only supports the postProcessingAction property, you must assign it different string values. For a list of supported string values, see Office.SpamReportingEventCompletedOptions.postProcessingAction.

Examples

// The following example handles a SpamReporting event to process a reported spam or phishing message.
function onSpamReport(event) {
    // Get 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.

        /**
         * Signal 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.",
            },
        });
    });
}

Fields

CustomFolder = "customFolder"

Specifies that a reported message is moved to a custom folder in the mailbox.

DeletedItemsFolder = "deletedItemsFolder"

Specifies that a reported message is moved to the Deleted Items folder of the mailbox.

JunkFolder = "junkFolder"

Specifies that a reported message is moved to the Junk Email folder of the mailbox.

NoMove = "noMove"

Specifies that a reported message remains in its current folder in the mailbox.