How to develop Outlook add-in in C#. Excel, PowerPoint,
FrontPage plug-in examples

C# HowTo samples

Note. The most recent C# HowTo samples are published on Add-in Express blog. Be sure to check it out, we add new HowTo examples every week.

Outlook general

How to program your first C# Outlook add-in

This Outlook add-in gives an example of how to write a COM add-in that works across all versions from Outlook 2000 to Outlook 2007. It shows how to develop Outlook-specific command bars and command bar controls, create 2007 Ribbon controls in Ribbon tabs and Outlook menu, make and control Outlook 2007 forms, add custom property pages to the Tools | Options and Folder Properties dialogs and more.

Also, please see the complete list of Add-in Express features for Outlook 2000 - 2007, a step-by-step example of building an Outlook COM add-in, and Add-in Express flash videos on how to write Outlook 2007 plug-in.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE (Outlook 2003)

How to place a .NET control onto a custom Outlook toolbar

This sample add-in (C# for Visual Studio 2005) intercepts the SelectionChange event of Outlook Explorer and displays selected properties of the currently selected MailItem in a UserControl that is added to a new toolbar. Find more about how to customize Outlook toolbar with any .NET controls. Watch a video about customizing Outlook 2003 toolbar.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to handle the ItemSend event of MS Outlook in C#

This C# sample shows how to handle the ItemSend event in Microsoft Outlook 2000 - 2007. You often need this when developing Outlook plug-ins.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to scan Outlook folders in C#

This C# example demonstrates how to scan folders in Outlook 2000, XP, 2003 and 2007 to get a tree view list of all folders.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to handle the SelectionChange event in Outlook

This C# sample for Outlook will be useful for novices at Outlook programming.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to handle the ExplorerClose event (Outlook) in C#

This Outlook example may be useful if you are making your first steps in Outlook programming.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to add custom menu items to the popup menu in Outlook Explorer

This sample shows how to populate the context menu of Outlook Explorer with your own menu items.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to create a command bar and command bar controls at run time (for Outlook)

This Outlook C# sample shows how to add a new button to your Outlook toolbar.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to change the CommandBarComboBox (ADXCommandBarComboBox) properties at run time

This sample shows how to change the ADXCommandBarComboBox properties at run-time in C#.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to create explorer and inspector command bars for mail and task items

This C# sample add-in demonstrates the creation of explorer and inspector command bars for mail and task items, and shows a property page. The VSTO edition of this add-in appends two option pages to Outlook.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to add a context menu item to the context menu of Outlook Explorer

This C# sample shows how to add a context menu item to the context menu of Outlook Explorer.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to add a property page to the Tools | Option menu in Outlook

This C# sample demonstrates how to add a property page to the Tools | Options... dialog box in Outlook.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to process Open, Read, Reply, ReplyAll and Send events for a mail, task, appointment in Outlook

This C# add-in shows how to use the Outlook Item Events class to process the events of an Outlook item.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to determine if an item was added to, changed in, or removed from a given Outlook folder(s)

This example shows on how to use the Outlook Items Events class and process the ItemAdd, ItemChange, and ItemRemove events of the MAPIFolder interface Items collection.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to determine if an Outlook folder was created, moved or deleted

This C# example shows how to use the Outlook Folders Events class and process the FolderAdd, FolderChange, and FolderRemove events of the Folders collection of the MAPIFolder interface.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to access MAPIFolder from the Outlook property page code

When dealing with Outlook Property or Option pages, you often need to access the add-in module. Download this C# example to see how to do it correctly.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

Advanced Outlook Regions

How to move a custom C# .NET form embedded into Outlook Explorer or Inspector from one form region to another

When embedding a custom form into an Outlook window, you may want to change the layout of the form at run-time. This sample add-in demonstrates how you can accomplish this task in C#. The user-interface of the add-in shows a command bar or a Ribbon tab (Office 2007 only) and allows choosing the layout from a combo box. Please note, you may need to change the references for the project to compile.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to cache forms embedded into Outlook Explorer windows

For forms embedded into Outlook Explorer windows, Add-in Express provides three form-caching strategies: no caching, showing the same form instance for all folders, and showing a new form instance for each folder. This C# Outlook sample addin demonstrates all the strategies. Please note that forms embedded into Outlook Inspector windows are always non-cached. More about customizing Outlook Explorer views.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to re-size a form embedded in Outlook Explorer or Inspector window

When a form is embedded into an Outlook window, Add-in Express displays a splitter that allows the user to change the size of the form. That's the behavior by default. For the developer to control the size of the form, the splitter should be made invisible (Splitter = None). This C# add-in for Visual Studio 2005 and VSTO is an example that demonstrates this behavior in Outlook 2000 - 2007.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to identify the form in an Outlook advanced form region in C#

This C# sample add-in for Visual Studio 2005 and VSTO shows how to identify an instance of the form embedded into an Outlook window. It shows several forms marked with a GUID. When you click on a command bar button (a Ribbon button in an Outlook 2007 inspector), the add-in identifies the currently active form instance and shows its GUID.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to set the visibility of the form in an Outlook advanced form region

This C# sample shows how to hide and show the form embedded into Outlook Explorer and new mail Inspector windows.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to use events of Reading Pane, Navigation Pane, and To-Do bar

This C# sample add-in for Visual Studio 2005 and VSTO 2005 demonstrates how you can make use of the events that are missing in Outlook:

  • Show / hide Navigation Pane (FolderList, Outlook Bar)
  • Show / hide / move Reading Pane (Preview Pane)
  • Show / hide / minimize To-Do Bar

Find more about special features to enhance Outlook bar, To-Do bar, Reading and Navigation panes.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to use several forms in one advanced form region

This sample add-in for VS 2005 and VSTO demonstrates how to use several forms in the same Advanced Form Region. Click a RadioButton on the Controlling form to activate the corresponding ADXOlForm. Find more about the Add-in Express Advanced Outlook Form Region technology.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to switch between the standard Outlook explorer view and your custom C# form

This Outlook add-in example shows how you can switch between the standard Outlook explorer view and your custom .NET form (ADXOlForm in the WebViewPane layout).
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

Outlook Extended MAPI

How to create and delete hidden Outlook items via Extended MAPI

This sample VS 2005 C# solution shows how to get, create and delete a hidden item in Outlook and Exchange with MAPI Store Accessor. For more details see the following article: How to get access to hidden Outlook items via Extended MAPI.
Available downloads:Sample add-in for VS 2005

Outlook security

How to disable Outlook security in a COM add-in?

Disables the Outlook security guard and shows contacts and message details.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to disable Outlook security in a standalone application?

This C# WinForms application disables the Outlook security guard and sends messages using a custom form.
Available downloads:Sample add-in for VS 2005

How to disable security warnings which show up when I use the Outlook object model, CDO, or Simple MAPI?

This sample turns off the Outlook, Simple MAPI and CDO security and shows the info of the first email.
Available downloads:Sample add-in for VS 2005

Excel general

How to develop an Excel RTD server in C#

This Excel Real-Time Data server project is described in the online Developer's Guide. Also see the Add-in Express flash video about Programming RTD servers.
Available downloads:Sample add-in for VS 2005

How to handle the WorkbookBeforeSave event of MS Excel

If you develop a COM add-in for Microsoft Excel, you may find this example useful.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to use dbs as a data source for RTD Servers in C#

This RTD server sample project demonstrates how to use System.Data.DataSet and System.Data.DataTable as a data source for real-time data servers in C#.
Available downloads:Sample add-in for VS 2005

How to create a custom toolbar in Excel?

This Visual Studio 2005 sample shows how to create a custom toolbar in Excel.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to process Change, SelectionChange, and other events of the Excel Worksheet class?

This sample shows how to use the Add-in Express Excel Worksheet Events class to process the Change event of the Excel worksheet.
Available downloads:Sample add-in for VS 2005

How to create an Excel document level add-in in C# ?

This is a simple implementation of a timesheet using MSForms controls.
Available downloads:Sample add-in for VS 2005

User-defined functions

How to create a simple Excel Automation add-in in C#

This Visual C# Excel Automation Add-in sample project is described in Automation add-in sample in VB.NET in the online Developer's Guide.
Available downloads:Sample add-in for VS 2005

Advanced Excel Task Panes

How to make an Excel task pane visible / invisible programmatically

This C# Excel sample demonstrates how to display your custom Advanced Excel Task Pane (ADXExcelTaskPane) using a command bar button, or how to prevent the task pane from being shown in Excel.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to interact with several Advanced Excel Task Panes in one layout position

This C# example shows how you can interact with several Excel task panes in one position. Click on a RadioButton control on the Controlling Task Pane to activate the needed ADXExcelTaskPane.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to develop a context-dependent Excel task pane

The C# sample add-in for Excel 2000 - 2007 shows how to dynamically show and hide an Advanced Excel Task Pane depending on whether cell A1 contains some string or doesn't.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

How to re-size an Excel task pane programmatically

This C# example for Excel shows how to change the size of an Excel task pane programmatically. There are two possible ways of doing it depending on the visibility of the splitter as set by the developer: if the splitter is visible, the user can change the size of the Excel task pane and the developer can not. To change the Excel task pane size programmatically, the developer sets the Splitter.Visible property to false. Find more about Advanced Excel Task Panes provided by Add-in Express.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

Word

How to create a Word document level add-in?

This is a simple implementation of a fax form using MSForms controls.
Available downloads:Sample add-in for VS 2005

PowerPoint

How to handle the SlideShowBegin event on presentation objects (PowerPoint) in C#

This sample shows how to handle the SlideShowBegin event of the PowerPoint presentation objects in C#.
Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

FrontPage

How to handle the FrontPage OnWindowActivate event

This sample shows how to handle the FrontPage OnWindowActivate event in C#.
Available downloads:Sample add-in for VS 2005

Project

How to handle the TaskChange event of MS Project in C#

This sample shows how to handle the TaskChange event of Microsoft Project in C#.
Available downloads:Sample add-in for VS 2005

Microsoft Office general

How to develop your first COM add-in for Microsoft Office in C#

This Visual C# sample add-in demonstrates how you can use Add-in Express for .NET to create a COM add-in supporting all versions of several Office applications, e. g. Excel and Word (the VSTO sample is for Excel 2003, 2007 only). It shows how to build toolbars and toolbar bar controls, add custom Office 2007 Ribbon tabs, make Office 2007 task panes and more.

    Also, please see a similar sample of building an Office add-in in the online Add-in Express Developer's Guide.
    Available downloads:Sample add-in for VS 2005 Sample add-in for VSTO 2005 SE

    How to write smart tags in C#

    This download accompanies the sample smart tag in VB.NET in the online Developer's Guide.
    Available downloads:Sample for VS 2005

    How to implement a custom recognizer for a Smart Tag?

    This example shows how to use the Recognize event of the Add-in Express Smart Tag component.
    Available downloads:Sample for VS 2005

    How to show a custom form when installing a COM add-in via ClickOnce

    This Visual C# solution for Excel demonstrates how to show a custom form (WinForm) when you install your COM add-in via ClickOnce in Visual Studio 2005.
    Available downloads:Sample add-in for VS 2005

    Internet Explorer

    Download Manager sample add-on for IE

    How to implement Drag-n-Drop in IE? How to download files? This sample add-on for IE is written in C#.NET (VS 2005) to highlight these themes. It works in IE 6 and IE 7.
    Available downloads:Sample add-in for VS 2005

    How to run and replace a script (JavaScript, JScript or VBScript) on an HTML page in IE 6 or 7

    This sample demonstrates how to execute a script on an HTML page opened in IE6 or IE7. The sample project shows an Internet Explorer toolbar with two buttons. By clicking on the first button you run a script contained in the sample HTML page (supplied in the download package). By clicking on the other button, you replace the script with a new one. Now, clicking on the first button executes the new script. This example is created for VS 2005, Visual C#, IE 6 and IE 7.
    Available downloads:Sample add-in for VS 2005