Office.SmartAlertsEventCompletedOptions interface
Specifies the behavior of a Smart Alerts add-in when it completes processing an OnMessageSend
or OnAppointmentSend
event.
Remarks
Examples
// 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 });
}
});
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for