Search code examples
outlookoffice-jsoutlook-addinoffice-addinsoutlook-web-addins

Outlook Add-in Desktop : Office.context.ui.close() not working on desktop version


I'm building an outlook add-in for web and desktop users. And I'm struggling to find the method that closes the add-in for the desktop version

In my Add-in, I inserted a button that invokes

Office.context && Office.context.ui && Office.context.ui.closeContainer();

onClick to close the add-in. This works on the web version of the add-in but not on the desktop one, Is there a problem with my code or is the desktop version not supporting this method ?

Environment setup : Microsoft Outlook 2016 (16.0.5182.1000) Exchange 2016 (build version 15.1.2375.7) on-premise


Solution

  • It should work for task panes on the desktop. Here is the description for the closeContainer method:

    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.

    But the minimum requirement set is 1.5 where Outlook 2016 is not supported.

    Also you may find a similar thread here.