Reputation: 81
I am developing an Outlook add-in using React with the below references.
https://learn.microsoft.com/en-us/office/dev/add-ins/tutorials/outlook-tutorial?view=outlook-js-1.8
https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/pinnable-taskpane?view=outlook-js-1.8
When user close/cancel the task pane from outlook add-in and I must detect any callback/event to log the custom data.
I tried different approaches below
added the onbeforeunload event to the window into my react Usercomponent.
window.addEventListener("beforeunload", (ev) => { debbugger; //// didnt get hit debugger user closes the task pane from the outlook add-in. });
I have tried with the componentwillunmount
componentWillUnmount()
{
console.log("componentWillUnmount");
debbugger;
//// didnt get hit debugger when user closes the task pane.
}
tried with the below code and didn't get any call back event
Office.context.document.addHandlerAsync(Office.EventType.DialogEventReceived,this.Handler);
Handler(input : any): any {
console.log(input);
debbugger;
//// didnt get hit debugger when user closes the task pane.
}
Add callback for ItemChanged event in Office.initialize()
Office.initialize = async () => {
Office.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged, (events: any) =>{ debugger; //// didnt get hit debugger when user closes the task pane. console.log(events); });
Reference for all available events for Office api https://learn.microsoft.com/en-us/javascript/api/office/office.eventtype?view=word-js-preview
Any suggestions about how I could achieve this?
I just need a callback event or method to log my custom data when the user closes the task pane
Thanks In advance.
Upvotes: 1
Views: 1261
Reputation:
Currently OfficeJS does not support TaskPaneClose event. We track Outlook add-in feature requests on our user-voice page. Please add your request there. Feature requests on user-voice are considered, when we go through our planning process.
Upvotes: 0