user2282005
user2282005

Reputation: 81

Outlook Add-ins : When user close/cancel the task pane from outlook add-in and I must detect any callback/event to log the custom data

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

  1. 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. });

  2. I have tried with the componentwillunmount

    componentWillUnmount() { console.log("componentWillUnmount");
    debbugger; //// didnt get hit debugger when user closes the task pane. }

  3. 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. }

  4. 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

Answers (1)

user7823505
user7823505

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

Related Questions