Skip to main content

Microsoft Outlook 2007-Add-in/Plug-in Development

Recently there was a requirement for Outlook plug-in development at place where I work and I grabbed this opportunity to write a detailed article about the basics of the outlook development and develop a demo application.



The development is almost similar to the normal development except some additional outlook classes that we need to know for the development.


The core of the development is the form regions that come in a variety, as depicted below.


Types of Form Regions


There are four types of form regions:


• Adjoining. Adjoining form regions display in addition to a standard or custom form. They appear in a special region at the bottom of the Inspector window or Reading Pane.


Replacement. Replacement form regions replace the default form of an item with the replacement form region. You can only use replacement and replace-all form regions with custom message classes.


Replace-all. Similar to the replacement form region, except that a replace-all form region deletes all the form pages and displays only the replace-all form region along with other form regions registered with the item's message class.


Separate. Separate form regions are similar to adjoining form regions in that they enhance existing forms. However, unlike adjoining form regions, separate form regions appear as an additional form page. To display a separate form region, click a button in the Show group on the Microsoft Office Fluent Ribbon.


Let me walk you through a sample app that does not do much in functionality however can serve as an excellent resource for beginners.


The following procedure shows you how to create a simple Outlook 2007 form region.


1. Start Microsoft Visual Studio 2008, create a New Project .Under project types, and expand Office.


2. Select 2007(as we are developing for Outlook 2007), and then select Outlook Add-In.



 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 3.  Bring the Add a new item dialog and then add select Outlook Form Region. This brings a wizard that needs to be completed before form region is added to the solution.



















4. Select the Adjoining option, and then click Next.



5. Name the form region to whatever you want, click Next and in the final dialog box, accept the default selection (Mail Message), and then click Finish.


6. From the Toolbox window, Right-click the design surface of the form region, and select View Code.


7. Now we’ll need to code in the FormRegionShowing method.


Developing Outlook 2007 form regions is almost similar to the process of creating a standard Windows form or user control.


Before we dive into the code, allow me to provide some more details.


When an Outlook Form Region is added using Visual Studio Tools for the Office, internally a Microsoft.Office.Tools.Outlook.FormRegionControl is added to the project. Also for three event handlers: FormRegionInitializing, FormRegionShowing, and FormRegionClosed are added.


FormRegionInitializing Event Handler:


This is fired when Outlook 2007 determines that the added form region should be associated with the current item.


This handler is critical in showing or hiding the added Form region in Outlook.


To prevent the form region from showing, set e.Cancel to true.


Note: Visual Studio Tools for the Office creates the FormRegionInitializing event handler within the Form Region Factory region which is collapsed by default.


FormRegionShowing Event Handler:


FormRegionShowing get fired before Outlook 2007 displays the form region.. FormRegionShowing initializes any controls on the form interface.


FormRegionClosed Event Handler:


FormRegionClosed gets fired after the form region closes and is generally used to perform clean-up tasks such as saving any changes to the form region.


Enough theory, let’s get back to coding.


The Plug-in that I am developing here will simply display the user details in a pane just below the Reading Pane and the steps for creation is same as described in the post.


Once we are on the View Code Window, we have three event handlers (don’t worry about this...the code is attached at the end of the article) and we we’ll be coding in the FormRegionShowing handler.


The Source Code is attached here


Following are resources that can get you more details about Outlook 2007 development.


Outlook Object Model Reference: 1


Outlook Object Model Reference: 2


Outlook MAPI reference






Outlook Code samples: 3



 Microsoft Office Development center


Hope this was Helpful.


Till Next We Connect….






Happy Learning!










Comments

Popular posts from this blog

Asp.Net 4.0: An Overview-Part-III

This is the last post in the series which will explore the following new features of ASP.Net 4.0  Performance Monitoring for Individual Applications in a Single Worker Process Web.config File Refactoring Permanently Redirecting a Page Expanding the Range of Allowable URLs Performance Monitoring for Individual Applications in a Single Worker Process It is a common practice to host multiple ASP.NET applications in a single worker process, In order to increase the number of Web sites that can be hosted on a single server. This practice results in difficulties for server administrators to identify an individual application that is experiencing problems. ASP.NET 4 introduces new resource-monitoring functionality introduced by the CLR. To enable this functionality, following XML configuration snippet is added to the aspnet.config configuration file.(This file is located in the directory where the .NET Framework is installed ) <?xml version="1.0" encoding="UTF-8"

WCF-REST Services-Part-II

HOW REST is implemented in WCF Part-I of the series explored the REST conceptually and this post will explore how REST is implemented in WCF. For REST implementation in WCF, 2 new attributes namely WebGetAttribute and WebInvokeAttribute are introduced in WCF along with a URI template mechanism that enables you to declare the URI and verb to which each method is going to respond. The infrastructure comes in the form of a binding ( WebHttpBinding ) and a behavior ( WebHttpBehavior ) that provide the correct networking stack for using REST. Also, there is some hosting infrastructure help from a custom Service¬Host ( WebServiceHost ) and a ServiceHostFactory ( WebServiceHostFactory ). How WCF Routes messages WCF routes network messages to methods on instances of the classes defined as implementations of the service. Default behavior ( Dispatching ) for WCF is to do this routing based on the concept of action. For this dispatching to work, an action needs to be present in ev

SOLID principles -Code Samples and Free Ebook

I planned to write code samples for SOLID principle implementations, however I am a firm believer of " NOT RE-INVENTING THE WHEEL ", when all you need is use the wheels and make a new CAR. Going by the ideology, I have found an excellent  SOLID principles FREE -Ebook ( covering all aspects of SOLID design principles, with Code sample). This book is an excellent visual aid to remember these principles, as it uses Motivational posters for explaining SOLID design principles. One additional advantage to the above mentioned book is the Code-Refactoring ebook . Both of these books can be downloaded from this EBOOK download Link Both of these books can be downloaded form here. Hope this book proves useful... Till next we connect.... Happy Learning..