zytham
zytham

Reputation: 623

Outlook Ribbon Customization

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 first image shows : i have added custom tab and it is loading correctly when i open outlook. second 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

Upvotes: 1

Views: 958

Answers (1)

SliverNinja - MSFT
SliverNinja - MSFT

Reputation: 31651

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;
}

Upvotes: 1

Related Questions