Outlook Ribbon Customization

﹥>﹥吖頭↗ 提交于 2019-12-11 14:32:46

问题


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 outlook

what 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!