Examples of how to build C# add-in / plug-in for Outlook, Excel, PowerPoint, FrontPage 

Visual C# .NET HOWTOs

  1. How to program your first C# Outlook add-in
  2. How to create your first add-in for Microsoft Office in C#
  3. How to place a .NET control onto a custom Outlook toolbar
  4. How to put a .NET control onto a custom Excel toolbar in C#
  5. How to move a custom .NET form embedded into Outlook Explorer or Inspector from one form region to another
  6. How to cache forms embedded into Outlook Explorer windows
  7. How to re-size a form embedded into Outlook Explorer or Inspector window
  8. How to identify the form in an Outlook Advanced Form region in C#
  9. How to set the visibility of the form in an Outlook Advanced Form Region
  10. How to use events of Reading Pane, Navigation Pane, and To-Do bar
  11. How to use several forms in one Advanced Form Region
  12. How to handle the ItemSend event of MS Outlook in C#
  13. How to scan Outlook folders
  14. How to handle Outlook's SelectionChange event
  15. How to access MAPIFolder from the code of the Outlook property page
  16. How to handle the ExplorerClose event (Outlook) in C#
  17. How to add custom menu items to the popup menu in Outlook Explorer
  18. How to create a command bar and command bar controls at run time (for Outlook)
  19. How to handle the FrontPage OnWindowActivate event
  20. How to handle the TaskChange event of MS Project in C#
  21. How to handle the WorkbookBeforeSave event of MS Excel
  22. How to handle the MouseClick event on presentation's objects (PowerPoint) in C#
  23. How to change the CommandBarComboBox (TadxCommandBarComboBox) properties at run time
  24. How to use dbs as a data source for RTD Servers in C#
  25. How to create and delete hidden Outlook items via Extended MAPI

1.  How to program your first C# Outlook add-in

This Outlook add-in gives an example of how to use Add-in Express 2007 for .NET for:

  • Writing one add-in that works across all Outlook versions from Outlook 2000 to Outlook 2007
  • Building Outlook-specific command bars and command bar controls
  • Creating Outlook 2007 Ribbon controls in Ribbon tabs and Outlook menu
  • Creating and controlling Outlook 2007 task panes
  • Adding custom property pages to the Tools | Options and Folder Properties dialogs
  • Handling application-level events
  • Using an event class for handling events of the Items collection (covers adding, removing, or changing Outlook Items)
  • Handling keyboard shortcuts
  • Using version-neutral Office interop assemblies
  • Enabling ready-to-use custom actions in setup projects

You can find this C# Outlook addin in the Samples folder of the Add-in Express installation folder(C:\Program Files\Add-in Express\Add-in Express 2007 for .NET %Edition%\Docs\Samples\). Also, please see the complete list of Add-in Express features for Outlook 2000 - 2007 and Add-in Express flash videos on how to write Outlook 2007 plug-in.

Available downloads:
Sample add-in project for VS 2005   Sample add-in project for VSTO 2005 SE (Outlook 2003)

 


2.  How to create your first add-in for Microsoft Office in C#

This Visual C# sample add-in demonstrates how with Add-in Express 2007 for .NET you can:

  • Create an add-in supporting all versions of several Office applications (Excel and Word)
  • Build command bars and command bar controls
  • Develop 2007 Ribbon controls in Ribbon tabs and Office menu
  • Create Office 2007 task panes
  • Handle application-level events
  • Use event classes for handling worksheet events
  • Use version-neutral Office interop assemblies
  • Use setup projects generated automatically
  • Enable ready-to-use custom actions in the setup project

If you have Add-in Express installed, you can find this C# example in the Samples folder of the Add-in Express installation folder (C:\Program Files\Add-in Express\Add-in Express 2007 for .NET %Edition%\Docs\Samples\). Also, please see a similar sample of building an Office add-in in the online Add-in Express Developer's Guide and flash video showing how to write an Office add-in.

Available downloads:
Sample add-in project for VS 2005   Sample add-in project for VSTO 2005 SE (Excel 2003)

 


3.  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. See also a video about customizing Outlook 2003 toolbar.

Download ZIP file

 


4.  How to put a .NET control onto a custom Excel toolbar in C#

This Excel addin is an example of how to process a number of Excel events: WorkbookActivate, SheetChange, NewWrokbook, etc. In the user-interface, the add-in shows the current state of AutoFilter and allows changing them via the Dialog class of the Excel object model. The sample is written in C# for Visual Studio 2005. See also Add-in Express video about how to add custom .NET controls to Excel toolbar.

Download ZIP file

 


5.  How to move a custom .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 form's layout at run-time. This sample add-in demonstrates how you 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. Both source code and the setup project are included. Please note, you may need to change the references for the project to compile.

Available downloads:
Sample add-in project for VS 2005   Sample add-in project for VSTO 2005   Sample add-in project for VSTO 2005 SE

 


6.  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 project for VS 2005   Sample add-in project for VSTO 2005.   Sample add-in project for VSTO 2005 SE.

 


7.  How to re-size a form embedded into 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 project for VS 2005   Sample add-in project for VSTO 2005.   Sample add-in project for VSTO 2005 SE.

 


8.  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 project for VS 2005   Sample add-in project for VSTO 2005.   Sample add-in project for VSTO 2005 SE.

 


9.  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 Inspector windows.

Available downloads:
Sample add-in project for VS 2005.   Sample add-in project for VSTO 2005.   Sample add-in project for VSTO 2005 SE.

 


10.  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 project for VS 2005.   Sample add-in project for VSTO 2005.   Sample add-in project for VSTO 2005 SE.

 


11.  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 project for VS 2005.   Sample add-in project for VSTO 2005.   Sample add-in project for VSTO 2005 SE.

 


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

Download ZIP file

 


13.  How to scan Outlook folders

Download ZIP file

 


14.  How to handle Outlook's SelectionChange event

Download ZIP file

 


15.  How to access MAPIFolder from the code of the Outlook property page

Download ZIP file

 


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

Download ZIP file

 


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

Download ZIP file

 


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

Download ZIP file

 


19.  How to handle the FrontPage OnWindowActivate event

Download ZIP file

 


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

Download ZIP file

 


21.  How to handle the WorkbookBeforeSave event of MS Excel

Download ZIP file

 


22.  How to handle the MouseClick event on presentation's objects (PowerPoint) in C#

Download ZIP file

 


23.  How to change the CommandBarComboBox (TadxCommandBarComboBox) properties at run time

Download ZIP file

 


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

Download ZIP file

 


25.  How to create and delete hidden Outlook items via Extended MAPI

This sample VS 2005 solution in C# 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.

Download ZIP file

 




Client login

 

Login 

Password 

 

Remember me

Forgot my password