How to troubleshoot 'onMessageSend' event not triggering in Outlook Addin?

Sobol, Jovanka 0 Reputation points
2025-04-07T20:10:01.5733333+00:00

We have been working on new Outlook Addin using new Microsoft framework. We faced the challenge when trying to implement event for onMessageSend. The problem is that validateSubjectAndCC does not get invoked, so we don't see text in console log.

 We used samples from here:

https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/outlook-on-send-addins?tabs=modern

We are using add-in only Manifest file:

            <ExtensionPoint xsi:type="Events">
                <Event Type="onMessageSend" FunctionExecution="synchronous" FunctionName="validateSubjectAndCC" />
            </ExtensionPoint>

 We updated commands.js file :

 

Office.onReady(() => {
  // If needed, Office.js is ready to be called.
     Office.actions.associate("onMessageSend", validateSubjectAndCC);

});

// Event handler for ItemSend event
export function validateSubjectAndCC(event) {
  console.log("onItemSend event triggered");
  // Simulate some async operation if needed
  // For demo purposes, allow the send to continue
  mailboxItem.cc.setAsync(['******@test.com'], { asyncContext: event });
  event.completed({ allowEvent: false });
}

Steps for reproducing issue:

  • Open Outlook on web
  • Click to create new email
  • Open my addin in taskpan
  • Enter To, Subject and Body
  • Click Send
  • I expected to see in Development Console log "onMessageSend event triggered"

Similarly, we would like to implement event onAppointmentSend. Can you please provide example and required permission for onAppointmentSend to work?

Sample manifest file:

manifest.xml

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,345 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.