How to enable Command functionality in Office add-ins

Tags: Office, add-in, Command, How to, Visual Studio, Code, XML

In this post I will highlight one workaround for issue with Office add-ins for Word, Excel and PowerPoint with Yeoman generator. The generator does not support creation of add-in Commands (except for Outlook) and it can create only add-ins with default Office add-in manifest. Common sense approach to enable Command functionality in this case would be as follows:

  1. Create add-in using Task Pane template, which would generate add-in manifest with RTM schema
  2. Add VersionOverrides manifest segment that contains definition of the Command functionality to the specified XML manifest (or copy VersionOverrides segment from one of Command samples from GitHub – Simple Example is a good candidate for that.
  3. Add necessary file/files to your web application that would perform required operations in the add-in.

After this step, you might be under impression that your add-in is finished, so you might try to add it to your local app catalog to sideload it into target Office application. And, after you copy manifest and browse your “Add add-in” menu in Ribbon, you might be surprised that the add-in is not visible there and not available for adding to Office client application. This behavior is, in fact, expected, as our manifest is invalid. Why?

So, RTM manifest contains standard namespaces,, like this

<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:type="TaskPaneApp">

but is missing two custom namespace definitions used in VersionOverrides element

xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov=http://schemas.microsoft.com/office/taskpaneappversionoverrides

Once we add these two namespace definitions to our opening OfficeApp element, our manifest will contain Valid XML definition for VersionOverrides and will be visible for adding to Office clients that support this functionality. Full XML of this tag should be like this:

<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">

No Comments

Add a Comment