Office.SpamReportingEventCompletedOptions interface
Specifies the behavior of an integrated spam-reporting add-in after it completes processing a SpamReporting event.
Remarks
Minimum permission level: read item
Applicable Outlook mode: Message Read
Examples
// 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.",
},
});
});
}
Properties
folder |
When you use the completed method to signal that a reported message has finished processing, this property specifies the Outlook mailbox folder to which the message will be moved. |
move |
When you use the completed method to signal that a reported message has finished processing, this property specifies whether the message is moved to a different folder in the mailbox. |
on |
When set to |
post |
When you use the completed method to signal that a reported message has finished processing, this property specifies whether the message is moved to a different folder in the mailbox. The following post-processing actions are available.
|
show |
When you use the completed method to signal that a reported message has finished processing, this property indicates if a post-processing dialog is shown to the user. The JSON object assigned to this property must contain a title and a description. If this property isn't specified, a dialog isn't shown to the user once their reported message is processed. |
Property Details
folderName
When you use the completed method to signal that a reported message has finished processing, this property specifies the Outlook mailbox folder to which the message will be moved.
folderName?: string;
Property Value
string
Remarks
Minimum permission level (Outlook): read item
Applicable Outlook mode: Message Read
Important:
If the specified folder doesn't exist yet, it will be created before the message is moved.
If the
postProcessingAction
property is set tomoveToCustomFolder
, thefolderName
property must be specified. Otherwise, the reported message is moved to the Junk Email folder of the mailbox. IfpostProcessingAction
is set to another action other thanmoveToCustomFolder
, thefolderName
property is ignored.
moveItemTo
When you use the completed method to signal that a reported message has finished processing, this property specifies whether the message is moved to a different folder in the mailbox.
moveItemTo?: MailboxEnums.MoveSpamItemTo;
Property Value
Remarks
Minimum permission level (Outlook): read item
Applicable Outlook mode: Message Read
Important:
You can only use this property in a spam-reporting add-in in Outlook on the web, on Windows (new and classic (starting in Version 2308, Build 16724.10000)), and on Mac. If you're using an earlier build of classic Outlook on Windows that supports the integrated spam-reporting feature, use the
postProcessingAction
property instead.If the property is set to
Office.MailboxEnums.MoveSpamItemTo.CustomFolder
, you must specify the name of the folder to which the message will be moved in thefolderName
property of theevent.completed
call. Otherwise, themoveItemTo
property will default toOffice.MailboxEnums.MoveSpamItemTo.JunkFolder
and move the reported message to the Junk Email folder.
onErrorDeleteItem
When set to true
, deletes a reported message if an error occurs while the message is processed. If this property is set to false
or isn't specified in the completed method, the reported message remains in its current mailbox folder.
onErrorDeleteItem?: boolean;
Property Value
boolean
Remarks
Minimum permission level (Outlook): read item
Applicable Outlook mode: Message Read
postProcessingAction
When you use the completed method to signal that a reported message has finished processing, this property specifies whether the message is moved to a different folder in the mailbox. The following post-processing actions are available.
delete
- Moves the reported message to the Deleted Items folder of the mailbox.moveToCustomFolder
- Moves the reported message to a specified folder. You must specify the name of the folder in thefolderName
property.moveToSpamFolder
- Moves the reported message to the Junk Email folder of the mailbox.noMove
- Leaves the reported message in its current folder.
postProcessingAction?: string;
Property Value
string
Remarks
Minimum permission level (Outlook): read item
Applicable Outlook mode: Message Read
Important:
In Outlook on Windows, you can only use this property in earlier builds that support the integrated spam-reporting feature. If you're on Version 2308 (Build 16724.10000) or later, use the
moveItemTo
property instead.This property isn't supported in Outlook on the web, on Mac, or in new Outlook on Windows. Use the
moveItemTo
property instead.If the property is set to
moveToCustomFolder
, you must specify the name of the folder to which the message will be moved in thefolderName
property of theevent.completed
call. Otherwise, thepostProcessingAction
property will default tomoveToSpamFolder
and move the reported message to the Junk Email folder.
Examples
// 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
When you use the completed method to signal that a reported message has finished processing, this property indicates if a post-processing dialog is shown to the user. The JSON object assigned to this property must contain a title and a description. If this property isn't specified, a dialog isn't shown to the user once their reported message is processed.
showPostProcessingDialog?: object;
Property Value
object
Remarks
Minimum permission level (Outlook): read item
Applicable Outlook mode: Message Read
Office Add-ins