
How do I find the right Tab Control when using VSTO to Add a Button to a Built-In Ribbon in Outlook New Mail Window?
Hi,
I am very new to the world of using VSTO to create add-ins for Outlook. I am using Visual Studio Community 2022 and Office 365 (Desktop).
What I need to do is write an add-in that will put a new group and button on the "Message" ribbon of the New Mail Message window.
So far, I have written my add-in to add a subject line and the message body text whenever a new mail message is opened, as per the walkthrough at https://learn.microsoft.com/en-us/visualstudio/vsto/walkthrough-creating-your-first-vsto-add-in-for-outlook?view=vs-2022&tabs=csharp. This worked perfectly when I ran the tests. Every New Email I created had the subject line and body text in it. I've left that code in while I try to develop the code to add the group and button to the ribbon to be sure my add-in is running.
I then followed the instructions at https://learn.microsoft.com/en-us/visualstudio/vsto/how-to-customize-a-built-in-tab?view=vs-2022 to customize a built-in ribbon. I searched through some of the Excel files in the download from Office 2010 help files: Office fluent user interface control identifiers (which delivered a Zip file named "Office2016FluentUserInterfaceControlIdentifiers") to get the name of the "Message" tab control, and the closest I could find is "TabNewMailMessage" in the Excel file "outlookmailitemcontrols". Scanning through the group controls on that tab, I was able to match up the following groups with the ribbon groups on the New Email window: Clipboard, Basic Text, Names and Include. So, I think I have the right ribbon control.
In Visual Studio, I added a Ribbon control, set the ControlID to "TabNewMailMessage", labelled the group "iMIS", and added a Button with the label "Committees". My VS design tab then showed the name of the Ribbon Control as "TabNewMailMessage (Built-In)". So it recognizes that I'm try to add controls to a built-in Ribbon.
However, when I tested it, I found that it did not insert the new Group and Button controls into the "Message" Ribbon on the New Email window, although I know the add-in is running because the subject and body text are still there. (By the way, I cleaned my solution after every test.)
I then tried the same on the "TabMail" Ribbon that I found in the Excel file "outlookexplorercontrols", hoping my new controls would show up in the "Home" ribbon of the Outlook Explorer, but the results were the same as above.
I can only conclude that I have gotten the wrong control names out of the Excel files. Can you help me to identify what built-in Ribbon Control I should be using to do what I need? Is there a document somewhere that tells me the names of the Ribbon Controls that are used on each window opened in Outlook? I find the Excel files not very helpful in that regard.
But, if I have the right tab control name, then what have I missed?
Thanks,
Terry ThielImage-1.png
Microsoft 365 and Office | Development | Other
