Creating Outlook 2007 Form Regions using Visual Studio Tools for the Office System (3.0)
Summary: Learn how to create a Microsoft Office Outlook 2007 form region by using Microsoft Visual Studio Tools for the Microsoft Office system (3.0).
Applies to: 2007 Microsoft Office System, Microsoft Office Outlook 2007, Microsoft Visual Studio 2008, Microsoft Visual Studio Tools for the Microsoft Office System (3.0)
Steve Hansen, OfficeZealot.com
Microsoft Office Outlook 2007 offers a way for developers to customize the Outlook 2007 user interface using elements called form regions. Using form regions, you can extend Outlook 2007 items such as mail, contact, or task items. Because form regions can display in the Reading Pane, you can build interesting add-ins that display context-sensitive data in addition to the content of the selected Outlook 2007 item. Microsoft Visual Studio Tools for the Microsoft Office system (3.0) features an Outlook Form Region designer that significantly simplifies the development of Outlook 2007 form regions.
If your form region is simple, creating it requires little code or effort on your part.
The following procedure shows you how to create a simple Outlook 2007 form region.
To create an Outlook 2007 form region
To develop custom form regions in earlier versions of Visual Studio Tools for Office, you design the form region in Outlook 2007. Then, you create a manifest file, implement the FormRegionStartup interface in an Outlook 2007 add-in, add a registry key that specifies the location of the manifest, create a form region class to wrap the form you created in Outlook 2007, and override the RequestService method in your add-in to return your form region class.
Visual Studio Tools for the Office system (3.0) handles all of these details for you. As a result, developing Outlook 2007 form regions closely resembles the process of creating a standard Windows form or user control.
When you add an Outlook Form Region to your project using Visual Studio Tools for the Office system (3.0), you actually add a Microsoft.Office.Tools.Outlook.FormRegionControl to your project. By default, when you add an Outlook Form Region to your project, Visual Studio Tools for the Office system (3.0) adds stubs for three event handlers: FormRegionInitializing, FormRegionShowing, and FormRegionClosed.
FormRegionInitializing occurs when Outlook 2007 determines that your form region should be associated with the current item (whether you select the item in an Explorer window and display it in the Reading Pane or open it in an Inspector window). This event traces back to the GetFormRegionStorage member on the Outlook.FormRegionStartup interface. If you want to show or hide your form region, implement the logic in the FormRegionInitializing event handler. To prevent the form region from showing, set e.Cancel to true. Visual Studio Tools for the Office system (3.0) creates the FormRegionInitializing event dler for you. You can find the event handler within the Form Region Factory region. This region is collapsed by default.
FormRegionShowing occurs before Outlook 2007 displays the form region. This event traces back to the BeforeFormRegionShow member of the Outlook.FormRegionStartup interface. FormRegionShowing initializes any controls on the form interface.
FormRegionClosed occurs after the form region closes. Visual Studio Tools for the Office system (3.0) adds this event. Use the FormRegionClosed event handler to perform clean-up tasks such as saving any changes to the form region.
Form Region Manifest Elements
Visual Studio Tools for the Office system (3.0) handles all of the details related to creating and managing a form region manifest. A form region manifest specifies attributes such as the name of the add-in that is associated with the form region, the type of form region, and its name and title. The manifest is a set of properties associated with a FormRegionControl. To modify manifest attributes, view the designer that is associated with a FormRegionControl and then modify the desired properties underneath the Manifest property in the Properties window.
Types of Form Regions
One of the elements under the Manifest property is the FormRegionType element. After you add a form region to your Visual Studio Tools for the Office system (3.0) project, you select the type of form region to add. If you change your mind later, you can change the type of form region by changing the FormRegionType property. There are four types of form regions:
Video Length: 00:15:28
File Size: 32.0 MB WMV