How to add a group to several built-in ribbon tabs (vsto)?

This is the add-on for VS2010 + Office 2010. All I want to do is add a button (or group of buttons) to several built-in tabs. For example, my buttons should be available both in the New Message Feed and in the New Subscription Feed . I tried to add a new tab (in Visual Designer), but this does not work. The button group is displayed on the New Message tab, but not on the Assignment tab. By the way, I use the following identifiers: TabNewMailMessageand TabAppointment.

+5
source share
3 answers

For someone else pulling their hair about it, the only way I could see my group on the Destination and New Mailbox tabs is to add one ribbon for each built-in tab and then copy / paste everything UI and code from one tape to another. Make sure you select the correct RibbonType (property of your ribbon) for each inline tab.

+4
source

I do not have Outlook, but I used the following in Word / Excel / PPT, so I hope that it will work in Outlook (unverified!).

Try adding a Ribbon element (XML), and then add two tabs with a button that looks the same and calls the same code, but with different identifiers.

XML:

<tab idMso="TabNewMailMessage">
    <group id="MyGroup1" label="My Group1">
        <button id="myButton1" label="Button 1" size="large"  onAction="ButtonOnAction" />
    </group>
</tab>
<tab idMso="TabAppointment">
    <group id="MyGroup2" label="My Group2">
        <button id="myButton2" label="Button 2" size="large"  onAction="ButtonOnAction" />
    </group>
</tab>

WITH#:

    public void ButtonOnAction(IRibbonControl control)
    {
        switch (control.Id)
        {
            case "myButton1":
            case "myButton2":
                // do something
                Console.Out.WriteLine("Button ID: {0}", control.Id);
                break;
        }
    }
0
source

, XML, , .

In Ribbon Designer, add a second tab to the ribbon and change the ControlID to the second place you would like to see in your group. Then right-click on the group in the original tab and click "Copy." Go to the new tab and paste the group there. He will copy everything that is already in the group. However, you will have to add events back. But for me, I just reused events already created, and it works great. CHEERS.

0
source

All Articles