Outlook 2010 Add-In : Add Button to Outlook using C#

Add Button to Outlook, is an interesting topic I am going to explain through this article. The step-by-step instructions will teach you how to add a Button to Ribbon Control in Outlook 2010.

I recommend you to read my previous Article, Outlook Add-In : Creating a Simple Add-In Using C#  before continuing to read this article.

  • This article applies to Outlook 2010.
  • This Add-In was created using Visual Studio 2012.
  • Tested on Outlook 2010 / Windows 7 Operating System

Step 1. Create an Outlook 2010 Add-In Project, using Visual Studio.

Step 2. Open the Solution Explorer window and right-click on it. Select Add > menu item from the context menu. And then, select New Item… to add a new item to the Project. Visual Studio will open Add New Item dialog.

Visual Studio - Add New Item to the Project
Visual Studio – Add New Item to the Project

Step 3. From the “Add New Item” dialog, select Office from the left side list, which is under the “Visual C# Items” entry. Visual Studio will display the list of Visual C# items, which are related to Office, in the right side list.

Add New Item dialog
Add New Item dialog

Step 4. Select “Ribbon (Visual Designer)” Visual C# item; which provides a Visual Designer for Basic Ribbon Customization tasks.

Provide the name to the new item, in the Name field and click on Add button. Visual Studio will add the Ribbon Control to the Project and open the Ribbon Control in the Visual Designer to allow to modify it.

Step 5. Now we will Customize this Ribbon Control to add a Button on it. Where we add the Button.? Buttons on Ribbon Control are grouped. There is already a group “group1” added to the Ribbon Control. So, we will add the Button inside this group.

From the Toolbox, drag the Button control and drop it in the group on the Ribbon Control.

Step 6. For more readability, we need to give proper names to the controls. Select each control on the Ribbon Control and start changing its properties. This is an important step.

Select Button control “button1”; and open properties of it, in the Properties window. Change below properties:

  • Change Label name to “Hello!“. This is just for the readability, you can give whatever name you want.

Step 7. Select group control “group1” and from Properties window; change  below properties:

  • Change Label name to “CodeSteps”. This is just for readability, you can give any relevant name.

Step 8. Select tab control “TabAddIns (Built-In)” on the Ribbon Control. From the Properties dialog, change the below properties: This is a Very Important Step.

  • One import property, we need to change is the OfficeId, which is under ControlId property. What value do we have to give here.? This is very important. Before we give the value, we need to decide, in which Tab in Outlook Ribbon Control; we would like to add our Button control.
  • Based on the value we give in OfficeId, Outlook will add our Button control into Outlook’s Ribbon Control.
  • For example, if we want to add a Button in Outlook’s “Home” Tab, we need to specify the OfficeId of the “Home” Tab.
  • OfficeId of the “Home” Tab is “TabMail”. How do we know this.? The list of OfficeIds for Outlook 2010 is available here  Office 2010 Help Files: Office Fluent User Interface Control Identifiers

Change the OfficeId property to “TabMail“.

Step 9. Lets’ Build & Run our Project. Visual Studio will open Outlook 2010 if our build was Successful.

Step 10. Check whether our “Hello!” button is added in Outlook’s Home tab. ITS’ NOT THERE. What went wrong.? It seems we miss to set up a few more properties. Lets’ close the Outlook 2010 Application.

Step 11. Go back to our Project in Visual Studio; select the Ribbon Control (not the Tab).

  • Change the RibbonType property to “Microsoft.Outlook.Explorer“.
Customized Ribbon Control
Customized Ribbon Control

Microsoft.Outlook.Explorer is Outlook’s main window, where we see the “Home” Tab (OfficeId: TabMail).

Step 12.  re-Build & Run the Project. Visual Studio will open Outlook 2010. Observer that, on the Home tab, we see the “Hello!” button under the group “CodeSteps”.

Add Button to Outlook
Add Button to Outlook

Visual Studio does a lot of stuff in the background when we Build the Project. It registers & attaches out Add-In to Outlook automatically.

Don’t forget to give your feedback about this article in below Comments section.


Outlook 2010 Add-In : Add Button to Outlook using C#

4 thoughts on “Outlook 2010 Add-In : Add Button to Outlook using C#

  1. “OfficeId of the “Home” Tab is “TabMail”. How do we know this.? ”
    How do you actually know this? I have reviewed this file and I can’t find any reference to “Home” being TabMail. Could you kindly tell me where I look exactly to find the reference that states what you have written? I’d have never found it except you have pointed it out. Many thanks

    1. Hello,

      It is simple. When you download and extract the file; you will see multiple files. Pick up the one related to the application; in this case, it is “OutlookExplorerControls.xlsx”.

      To identify the right tab, look in “Control Type” & “Control Name” columns in the Excel sheet. “Home” is the tab type control. Hence, it’s “Control Type” is “tab”.

      But, control name is not “TabHome”; instead it is “TabMail”. You can verify this with other control names in it’s group. For example; Reply, Reply All etc,. are part of this tab.



Leave a Reply

Your email address will not be published.

Scroll to top