user5501201
user5501201

Reputation: 245

How to have add-in buttons dynamically enabled\disabled on the ribbon

I am working on an add-in to Office365/Office2016 which helps archiving office document into our own repository (content server). Users can initiate content management related operation using add-in command which are shown as ribbon button onto the office ribbon. This operation includes importing document into repository, exporting from repository and showing up into office application etc.

Problem: While the add-in command helps initiating operation into the add-in perfectly fine, we do not see these add-in buttons can be dynamically enabled\disabled on the ribbon. These buttons are static and can only be added and removed using only manifest file which is not a feasible solution. This was the case with office thick client COM based add-in. While this functionality is missing in officeJS.

Upvotes: 2

Views: 1100

Answers (2)

Vikas Sawant
Vikas Sawant

Reputation: 43

Enabling and disabling custom add-in commands (buttons and menu items) dynamically are currently supported and it is in preview mode as of today. please find the Microsoft link.

https://developer.microsoft.com/en-us/office/blogs/build-contextual-ui-experiences-with-office-add-ins/?_cache_bypass=1583954660

Developer docs: https://learn.microsoft.com/en-us/office/dev/add-ins/design/disable-add-in-commands

Upvotes: 0

Slava Ivanov
Slava Ivanov

Reputation: 6912

All ribbon controls are described in the manifest.xml file and currently do not have any dynamic control over them. You cannot disable/enable the items.

If you want to see this feature in upcoming Office.js releases, you may post your own business case request at officespdev.uservoice.com or up-vote similar request: Support dynamic content in Add-in commands ribbon dropdown menu

Upvotes: 3

Related Questions