MSDN Magazine Launch Issue - February 15, 2008 - (Page 55) Adjoining These appear at the bottom of the target Outlook form on the first Outlook form page and/or at the bottom of the Outlook reading pane. Separate These add a new page to the form. Replacement These cause the form region to replace all of the content on the first form page of the Outlook form (all existing form pages are left in place). Replace All These cause the form region to replace all of the content on the first form page of the Outlook form, and they remove all other form pages from the form. Each one of these form regions allows you to extend Outlook in interesting ways, but here I’ll focus on the Replacement form region. The Replacement form region can be used to create a custom form for a custom message class. Unlike the Adjoining and Separate form regions that are created for existing Outlook message classes—for example, Mail Message (IPM.Note), Figure 1 Selecting Outlook Add-In Project Template Contact (IPM.Contact), and Appointment (IPM.Appointment)—when selecting the Replacement (or Replace All) form that in this field I’ve entered IPM.Note.CustomerSalesData, which region, you create a custom message class that derives from one of means that I’m going to derive my custom message class from the the existing Outlook message classes. For example, in the sample, Outlook IPM.Note message class type (or essentially create a cusI’ll walk through a custom message class called CustomersSales- tom message class type that inherits all of the same functionality Data that derives from the Mail Message type; thus, what results is in the stock Mail Message class). All form regions target one or more specific message classes in a custom message class called IPM.Note.RecentSales. the Outlook environment. These message classes are directly related to the Outlook item type. There are eight standard message Building Your First Custom Form Region To create this custom Replacement form region, I used Visual classes (see Figure 3) and, theoretically, an infinite number of cusStudio 2008 to create an Outlook 2007 Add-in project (see Figure 1). tom message classes. You could similarly derive your custom class I named the project CustomOFR and used the default project loca- from other custom class types. After you’ve entered your custom tion. At this point, Visual Studio creates an Outlook 2007 Add-in message class derivation and name, click Finish. The name will be project shell for you. This means that when you build and deploy validated when you click the Finish button. When you’ve completed the steps in the wizard, a form region your add-in (which will contain your custom Outlook form region), Visual Studio will automatically load your add-in when will be added to the Outlook add-in project. In my case, the following three items were added to the project: Outlook loads. With your project shell now created, let’s go ahead and add a custom Outlook form region to it. Select Outook Form Region from the Add New Item Dialog and name the region SalesData. This invokes the New Outlook Form Region Wizard, which involves a number of steps to create a Replacement form region. In the first step you indicate whether you’re designing a new form region or importing an existing one (.ofs file). In this sample, you want to create a new form region, so go ahead and click Next. Then you’ll be asked to select the type of form region you want to create. Select the Replacement type and then click Next. At this point, you’ll set some properties for your form region; specifically a name, title, description, and the modes in which you want to display the form region (see Figure 2). After you’ve entered this information, click Next. In the final step, you’ll associate your form region with a specific message class. As I mentioned earlier, because this is the Replacement form region you must create a custom message class instead of using the stock message classes that ship with Outlook. You’ll notice that in this case, this step has all of the stock message class options grayed out, and the only field available for this step is the custom message class textbox at the bottom of the dialog (see Figure 3). You’ll see Figure 2 Custom Form Region Properties launch2008 55
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.