Creating a custom Tab in VSTO

If you haven’t used VSTO, it’s the framework for developing Office Integrations.  Yes, people are still developing Office plugins, although Flow is coming on strong, there is still a need for organizations to have components directly embedded in their primary applications of choice.

If you’re looking to get started on building your own Tab in Office you can do this very easily by adding a Ribbon.xml file to your VSTO project with the following syntax.

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
 <ribbon>
 <tabs>
 <!--<tab idMso="TabMail">-->
 <tab id="tabForgotten" label="Coder">
 <group id="MyGroup" label="Content">
 <button id="btnGo" label="Connect" 
 screentip="Go" onAction="OnConnectClicked"
 supertip="Go to start."/>
 </group>
 </tab>
 </tabs>
 </ribbon>
</customUI>

Once you’ve added that snippet, simply navigate back to your main AddIn.cs file and instantiate your ribbon.

protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{
return new SuperRibbon();
}

Compile and run (in this example, I created an Outlook VSTO plugin) and you can now see your new menu item.

Capture

Connecting the events are even easier as a complimentary .cs file is created where you can easily wire up this event.

public void OnConnectClicked(Office.IRibbonControl control)
{

System.Diagnostics.Debug.WriteLine("HERE");
}

Lastly, you’ll notice that in my XML tab declaration there is a value that is commented out called TabMail.  All built-in Tabs have their own tabs that you can piggy back off to include your controls therein instead of creating your own tab as was done previously.  All that needs to change is that value.

What it is

Over the past few years, I’ve found myself drifting further from code and not developing as much as I’d really like to be.

Over the past few months I’ve been experimenting with LinkedIn as a blogging platform for technical articles and it really hasn’t felt it like it quite cuts it.  Coupled with this, I used to blog about anything technical that I was doing – Powershell, Lync, C#, SQL, etc – but then started to break it out by technology for better readability.  But that always left me with more to say and nowhere to say it.

So, I’m going back to a single technical blog, about everything and anything as I jump into everything going on around me.  In the coming months, I’m probably going to be focussing more on the Dynamics and SqlAzure fronts as that is where I’m spending a great deal of my time, but I have some branching ideas into other areas of tech that I think I’ll just keep sharing.

Have I forgotten everything?  Let’s see.