Reputation: 725
In my Outlook add-in, I assign a custom ribbon (a new group with controls) to the inspectors initially to support some functionalities for some mails that I create manually. This custom tab is being displayed when I open every mail item regardless the store or folder. I wantto make this tab visible only for the inspectors of the custom mail items I manually create.
Following is a fragment of the xml of which I add as the custom UI for inspectors in code. I have added a callback method to get executed to set the visibility (GetCustomGroupVisible).
<ribbon>
<tabs>
<tab idMso="TabReadMessage">
<group id="MyCustomGroup" insertBeforeMso="GroupMailDelete" getVisible="GetCustomGroupVisible">
<button id="Button1" size="large" onAction="ButtonClick" />
<button id="Button2" size="large" onAction="ButtonClick" />
</group>
</tab>
</tabs>
</ribbon>
// Callback method
public bool GetCustomGroupVisible(IRibbonControl control)
{
bool makeVisible = false;
if ( // this is one of my custom mails !)
{
makeVisible = true;
}
return makeVisible;
}
My problem is, the above shown callback method "GetCustomGroupVisible" is not being called sometimes when I open a new inspector. Why is this happening like that ? What should I do to have this callback method executed each time I open a new inspector. What am I missing ?
Upvotes: 0
Views: 198
Reputation: 66215
You need to force ribbon update when NewInspector event fires. Call IRibbonUI.Invalidate. IRibbonUI can be retrieved from the OnLoad ribbon callback (must be specified in the ribbon XML).
Upvotes: 1