To create a form region, add an Outlook Form Region item to an Outlook add-in project. This starts the New Outlook Form Region wizard.
Use the wizard to indicate whether you want to design a new form region or import a form region that was designed in Outlook. For more information about designing a new form region, see Using the Form Region Designer. For more information about using a form region designed in Outlook, see Importing a Form Region Designed in Outlook.
Use the wizard to specify the type of form region you want to create. The following table describes each form region type.
Region type | Description |
|---|
Separate | Adds the form region as a new page in an Outlook form. |
Adjoining | Appends the form region to the bottom of an Outlook form's default page. |
Replacement | Adds the form region as a new page that replaces the default page of an Outlook form. |
Replace-all | Replaces the whole Outlook form with the form region. |
You can also use the wizard to specify display conditions and to select the type of form to extend. For more information, see How to: Add a Form Region to an Outlook Add-in Project.
The selections that you make in the wizard affect the options that are available in other wizard pages. For example, if you select Adjoining or Separate in the Create a New Outlook Form Region page, then the Title and Description fields are unavailable in the Supply descriptive text and select your display preferences page. This is because Outlook does not use these fields when it displays an adjoining or separate form region.
Form Region Files
When you complete the New Outlook Form Region wizard, Visual Studio Tools for Office automatically adds the following files to your project:
A form region code file. This file has the name that you specify for the Outlook Form Region item in the Add New Item dialog box. Add code to handle form region events to this file.
A form region designer code file. This file contains code generated by the form region designer and should not be directly edited.
An Outlook Form Storage (.ofs) file.
Note: |
|---|
This file is only added to the project if you import a form region that was designed in Outlook. |
Form Region Factory Class
The form region code file contains a partial class that implements the IFormRegionFactory interface. This is the form region factory class. The form region factory class is responsible for creating new instances of the form region.
You can find this class by expanding the Form Region Factory region.
The New Outlook Form Region wizard adds attributes to this class that specify the internal name of the form region and the message classes that display the form region. You can modify these attributes manually after the file has been added to the project.
Most of the form region factory class is implemented in the form region designer file. However, the FormRegionInitializing event handler is exposed in the form region code file. You can use this event handler to specify whether Outlook should display the form region. For more information, see Handling Form Region Events.
If you have an Outlook form region that you used in another Visual Studio Tools for Office project, you can reuse it in your current Outlook add-in project by using the Add Existing Item dialog box.
The existing form region must have a code file (.vb or .cs); you cannot add Outlook Form Storage (.ofs) files by using the Add Existing Item dialog box. However, you can create a new form region by importing an Outlook Form Storage file. For more information, see How to: Add a Form Region to an Outlook Add-in Project.