Building an Outlook 2013 Add-in

visual-studio-2013

Creating Add-ins for office products has become easier than before thanks to VSTO. It stands for Visual Studio Tools for Office and it’s a set of tools(Visual studio project templates and an API) that allows developers create Add-ins for Microsoft office using any managed code like C# and VB.Net.
In this blog post, I’m going to show you how to build a Add-in for Outlook 2013 using C# and VS 2013. Just remember that all steps and code snippet that you’re going to see here is not specific for Outlook Add-ins but all other office components like Word and Excel.

Creating an Outlook Add-in walkthrough

First of all we need to create a new Outlook 2013 Add-in project:

 

 

2014-07-12_23-13-18

 

the default add-in project will looks like this:

2014-07-12_23-19-05

Now let’s add a new Ribbon item to our project

2014-07-12_23-25-41

You’ll get an empty Ribbon like this

2014-07-12_23-43-50

Let’s add a test button from the toolbox, change its properties, give it a cool icon and custom tooltip. This button will just show a message for the user

2014-07-12_23-51-42

Now double click on the button in order to add an event handler to it. We gonna use the MessageBox class to show a simple message to the user

        private void showMessage_Click(object sender, RibbonControlEventArgs e)
        {
            MessageBox.Show("This is my first VSTO Button", "Information",     MessageBoxButtons.OK,MessageBoxIcon.Information);
        }

When your run this project, Outlook will be launched and our simple Add-in will be loaded into it.
By default, our Ribbon will be shown in the read mail window so in order to see our button you have to double click an email to launch the read mail window, our button will be in the complement Ribbon

2014-07-12_23-58-48

just click the button to see the messageBox we already add it in the button event handler

2014-07-12_23-59-25

If you want to change where our button will be shown, you have to change the properties of our Ribbon. All possible locations will be available in the RibbonType property

2014-07-13_00-11-49

Summary

Since the official release of VSTO, creating add-ins for office components in managed code has become possible and you can see how simple that was. Now you can admit that is the missing piece every .net developer was waiting for to expand their programming skills to Microsoft Office Suite.

Advertisements

One thought on “Building an Outlook 2013 Add-in

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s