Search code examples
javascriptxmloutlook-web-addins

Is there a way to to close current taskpane in outlook web add-in?


I was wondering if there was a way to close a taskpane programmatically in an outlook web add-in.

I followed this link : https://learn.microsoft.com/en-us/office/dev/add-ins/develop/show-hide-add-in

But Office.addin.hide() and Office.addin.showAsTaskpane() are not working.

Can someone help me?


Solution

  • Use the Office.context.ui.closeContainer() which closes the UI container where the JavaScript is executing.

    The behavior of this method is specified by the following:

    • Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open.

    • Called from a task pane: The task pane will close. Any dialog opened by displayDialogAsync will also close. If the task pane supports pinning and was pinned by the user, it will be un-pinned.