Activate your Outlook add-in without the Reading Pane enabled or a message selected
Article
With a simple manifest configuration, you can create Outlook add-ins for the Message Read surface that activate a task pane without the Reading Pane enabled or a message first selected from the mailbox. This feature is called "no item context". Follow the walkthrough to learn more and unlock additional capabilities for your add-in. For example, you can enable your users to access content from different data sources, such as OneDrive or a customer relationship management (CRM) system, directly from their Outlook client.
Delete the second object in the "extensions.runtimes" array, whose "id" is "CommandsRuntime".
The "extensions.ribbons.tabs.groups.controls" array has two objects. Delete the second one, whose "id" is "ActionButton".
To activate your add-in with the Reading Pane turned off or without a message selected, you must add the SupportsNoItemContext child element to the <Action> element and set its value to true. As this feature can only be implemented with a task pane in Message Read mode, the following elements must also be configured.
The xsi:type attribute value of the <ExtensionPoint> element must be set to MessageReadCommandSurface.
The xsi:type attribute value of the <Action> element must be set to ShowTaskpane.
In your preferred code editor, open the Outlook quick start project you created.
Open the manifest.xml file located at the root of the project.
Select the entire <VersionOverrides> node and replace it with the following XML.
XML
<VersionOverridesxmlns="http://schemas.microsoft.com/office/mailappversionoverrides"xsi:type="VersionOverridesV1_0"><VersionOverridesxmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1"xsi:type="VersionOverridesV1_1"><Requirements><bt:SetsDefaultMinVersion="1.13"><bt:SetName="Mailbox"/></bt:Sets></Requirements><Hosts><Hostxsi:type="MailHost"><DesktopFormFactor><!-- Message Read mode--><ExtensionPointxsi:type="MessageReadCommandSurface"><OfficeTabid="TabDefault"><Groupid="msgReadGroup"><Labelresid="GroupLabel"/><Controlxsi:type="Button"id="msgReadOpenPaneButton"><Labelresid="TaskpaneButton.Label"/><Supertip><Titleresid="TaskpaneButton.Label"/><Descriptionresid="TaskpaneButton.Tooltip"/></Supertip><Icon><bt:Imagesize="16"resid="Icon.16x16"/><bt:Imagesize="32"resid="Icon.32x32"/><bt:Imagesize="80"resid="Icon.80x80"/></Icon><Actionxsi:type="ShowTaskpane"><SourceLocationresid="Taskpane.Url"/><!-- Enables your add-in to activate without the Reading Pane enabled or a message selected. --><SupportsNoItemContext>true</SupportsNoItemContext></Action></Control></Group></OfficeTab></ExtensionPoint></DesktopFormFactor></Host></Hosts><Resources><bt:Images><bt:Imageid="Icon.16x16"DefaultValue="https://localhost:3000/assets/icon-16.png"/><bt:Imageid="Icon.32x32"DefaultValue="https://localhost:3000/assets/icon-32.png"/><bt:Imageid="Icon.80x80"DefaultValue="https://localhost:3000/assets/icon-80.png"/></bt:Images><bt:Urls><bt:Urlid="Taskpane.Url"DefaultValue="https://localhost:3000/taskpane.html"/></bt:Urls><bt:ShortStrings><bt:Stringid="GroupLabel"DefaultValue="Test walkthrough"/><bt:Stringid="TaskpaneButton.Label"DefaultValue="Show Taskpane"/></bt:ShortStrings><bt:LongStrings><bt:Stringid="TaskpaneButton.Tooltip"DefaultValue="Opens a task pane."/></bt:LongStrings></Resources></VersionOverrides></VersionOverrides>
Save your changes.
Configure the task pane
In your project, navigate to the taskpane folder, then open taskpane.html.
Replace the entire <body> element with the following markup.
HTML
<bodyclass="ms-font-m ms-welcome ms-Fabric"><headerclass="ms-welcome__header ms-bgColor-neutralLighter"><imgwidth="90"height="90"src="../../assets/logo-filled.png"alt="logo"title="Add-in logo" /><h1class="ms-font-su">Activate your add-in without enabling the Reading Pane or selecting a message</h1></header><sectionid="sideload-msg"class="ms-welcome__main"><h2class="ms-font-xl">Please <atarget="_blank"href="https://learn.microsoft.com/office/dev/add-ins/testing/test-debug-office-add-ins#sideload-an-office-add-in-for-testing">sideload</a> your add-in to see app body.</h2></section><mainid="app-body"class="ms-welcome__main"style="display: none;"><ulclass="ms-List ms-welcome__features"><liclass="ms-ListItem"><iclass="ms-Icon ms-Icon--CheckList ms-font-xl"></i><spanclass="ms-font-m">Item multi-select is automatically enabled when the <b>SupportsNoItemContext</b> manifest element is set to <code>true</code>. You can test this by selecting multiple messages in Outlook, then choosing <b>Show Taskpane</b> from the ribbon.</span></li><liclass="ms-ListItem"><iclass="ms-Icon ms-Icon--Pin ms-font-xl"></i><spanclass="ms-font-m">Support to pin the task pane is also automatically enabled. You can test this by selecting the <b>pin</b> icon from the top right corner of the task pane.</span></li><liclass="ms-ListItem"><iclass="ms-Icon ms-Icon--DockRight ms-font-xl"></i><spanclass="ms-font-m">This feature can only be implemented with a task pane.</span></li><liclass="ms-ListItem"><iclass="ms-Icon ms-Icon--Design ms-font-xl"></i><spanclass="ms-font-m">Implement your scenario using this feature today! For example, enable your users to access content from different data sources, such as OneDrive or your customer relationship management (CRM) system, without first selecting a message.</span></li></ul></main></body>
Save your changes.
Update the task pane JavaScript file
From the taskpane folder, open taskpane.js.
Navigate to the Office.onReady function and replace its contents with the following code.
Support for the item multi-select and pinnable task pane features
Enabling support for no item context in the manifest automatically enables support for item multi-select and pinnable task pane features, even if these features aren't explicitly configured in the manifest.
Feature support in Outlook on the web and new Outlook on Windows
In Outlook on the web and new Outlook on Windows, add-ins that implement no item context don't activate when the Reading Pane is hidden or when a message isn't selected. This is because add-in commands in Outlook on the web don't appear on the ribbon. To activate an add-in from the Message Read surface, you must first select a message, then select the add-in command from the message action bar.
Since enabling no item context automatically enables the item multi-select feature, you'll be able to activate your add-in in Outlook on the web and new Outlook on Windows on multiple mail items.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins feedback
Office Add-ins is an open source project. Select a link to provide feedback: