Reputation: 11
I am following article https://learn.microsoft.com/en-us/office/dev/add-ins/develop/add-in-manifests?tabs=tabid-1 and https://learn.microsoft.com/en-us/office/dev/add-ins/design/disable-add-in-commands . The method Office.onReady is active when task pane is opened . I want to call method on background to enable/disable add-ins tabs . Is any Office API and Graph API available for it ?.
Upvotes: 0
Views: 269
Reputation: 49397
The requestUpdate method is used to toggle the enabled or disabled status of a custom button on either a custom contextual tab or a custom core tab. For details about this, see Enable and Disable Add-in Commands. There may be scenarios in which you want to change both the visibility of a tab and the enabled status of a button at the same time. You do this with a single call of requestUpdate
. The following is an example in which a button on a core tab is enabled at the same time as a contextual tab is made visible.
function myContextChanges() {
Office.ribbon.requestUpdate({
tabs: [
{
id: "CtxTab1",
visible: true
},
{
id: "OfficeAppTab1",
groups: [
{
id: "CustomGroup111",
controls: [
{
id: "MyButton",
enabled: true
}
]
}
]
]}
]
});
}
Be aware, custom contextual tabs are currently only supported on Excel and only on these platforms and builds:
Read more about that in the Create custom contextual tabs in Office Add-ins article.
If you need to get the same functionality in other Office applications, I'd suggest posting or voting for feature requests on Tech Community, they are considered when the dev team go through the planning process. Use the github label: Type: product feature request
at https://aka.ms/M365dev-suggestions .
Upvotes: 0