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...

Covariance and Contravariance-General Discussion

If you have just started the exploration of .Net Framework 4.0, two terms namely Covariance and Contravariance might have been heard. The concept that these terms encapsulate are used by most developer almost daily, however there has never been any botheration about the terminologies. Now, what actually these terms mean and how are these going to affect us as a developer, if we dive in to the details. The simple answer is it’s always good to know your tools before actually using them. Enough philosophy, let’s get to the business. Starting the discussion let me reiterate that in addition to Covariance and Contravariance, there is another terminology, Invariance. I’ll by start here by diving into the details of Invariance and then proceed further. Invariance: Invariance can be better understood by considering the types in .Net.>net has basically two type, value-types and reference-types. Value types (int, double etc) are invariant i.e. the types can’t be interchanged either ...

Advanced WCF

In this post, I am sharing the link of articles about  advanced topics in WCF. The List of articles is exhaustive and can serve as your repository for all WCF queries. Concurrency,Throttling & Callbacks  WCF Concurrency (Single, Multiple and Re entrant) and Throttling   WCF-Interop and BinarySecurityToken  WCF Callbacks  Creating Web Services From WSDL Link1 Link2 Link3 Link4 WCF-Security WCF over HTTPS   Transport Security(basic)/HTTPS UserNamePasswordValidator ServerCertificateValidationCallback 9 simple steps to enable X.509 certificates on WCF - CodeProject http://www.codeproject.com/KB/WCF/9StepsWCF.aspx?display=Print Message Security(Certificate)/PeerTrust Securing WCF Services with Certificates. - CodeProject http://www.codeproject.com/KB/WCF/wcf_certificates.aspx Message Security(Certificate)/ChainTrust How To Configure WCF Security Using Only X.509 Certificates - CodePr...