问题
i have added a tab in outlook ribbon in using vc++ in visual studio.but i need to hide the tab when opening a perticular mail in outlook 2010. i have attched snapshot for the same
first image shows : i have added custom tab and it is loading correctly when i open outlook. now come to requirements .. second image shows : custom tab i have to hide from there when i am opening a perticular mail in outlook and i have to add the same below More option in outlookwhat xml to added or removed to make it work
help needed work in progress.
thanks
回答1:
You need to handle the tab getVisible
event in your Ribbon UI.
<ribbon>
<tabs>
<tab id="MyTab" getVisible="MyTab_GetVisible" label="MyTab">
<group label="MyGroup" id="MyGroup" >
<button id="MyButton" size="large" label="MyButton" imageMso="HappyFace" onAction="OnMyButtonClick"/>
</group>
</tab>
</tabs>
</ribbon>
To toggle the tab visibility, you need to implement MyTab_GetVisible
depending on your needs. See SampleAddin on MSDN for reference.
// Only show MyTab when inspector is a read note.
public bool MyTab_GetVisible(Office.IRibbonControl control)
{
if (control.Context is Outlook.Inspector)
{
Outlook.Inspector oInsp = control.Context as Outlook.Inspector;
if (oInsp.CurrentItem is Outlook.MailItem)
{
Outlook.MailItem oMail = oInsp.CurrentItem as Outlook.MailItem;
return oMail.Sent;
}
else
return false;
}
else
return true;
}
来源:https://stackoverflow.com/questions/10331029/outlook-ribbon-customization