RCPI Outlook 2007 Form Region Add-In Templates Released

After what seems like months but in fact has only been.... months, I'm finally ready to release what I hope will be a useful bit of code for anybody wanting to use Outlook 2007 Form Regions.

The RCPI Outlook 2007 Form Region Add-Ins consist of a set of Visual Studio 2005 templates for making working with Form Regions much easier by defining a specialized Outlook 2007 add-in that can host one or more Form Regions.  The templates and wizards generate all of the plumbing code needed leaving the developer free to concentrate on the functionality of the form region.

I've also created a quick (~7 minute) video (no longer available). I'll attach a rough transcript at the bottom of this blog post.  I'll also be adding a "Behind the scenes" video later in the week to describe the code that comes with the templates that does all the heavy lifting. 

Here's the transcript:


Hi, this is Paul Ballard from Rochester Consulting Partnership.  If you're like me you probably heard about the new Outlook 2007 form region functionality; the ability to combine custom application logic with Outlook 2007 inspectors, only to be disappointed by the development process which involves fun things like manual registry edits and new XML schemas. 

What I'm going to show you today is a set of Visual Studio 2005 Templates for creating an Outlook 2007 add in specifically for hosting Form Regions.  These templates are available for both Visual Basic and C# and will hopefully make building and using Form Regions much easier.

To start creating a form region you first have to create the form in Outlook.  Do this by clicking on "Tools" then "Forms" and then "Design a form".  You can choose any form type, I'm going to choose a Contact.  In the form designer window you'll see a new button for Form Regions with two options, either create a new form region or open an existing one.  For expediency I'm going to open a simple form region that I've already created.  This form region will simulate the features of the Message Header example for form regions that was written for MSDN by Ryan Gregg.  You can see that this form region has only a text box for displaying the message headers and a copy button to copy the text to the clipboard.  Now I'll save that form region to an OFS file and we're ready to start building our add-in.

When the templates are installed they register themselves in Visual Studio under a specific language, either Visual Basic or C# and then under the Office/Office 2007 Addins section.  Here you see the Form Region Add-In project.  I'll select that and then it will start to generate some files and then popup a new Wizard window for creating Outlook Form Regions.

The first thing to do in the wizard window is to import the OFS file we just saved from inside Outlook.  I'll select this from my hard drive.  Then I'll give the form region a more readable header.  Next I need to decide if this form region will be adjoining, meaning attached to the bottom of an existing inspector or a separate form.  If I choose to use a separate form, I can also import an icon to be used in the button on the Inspector.  But in this case I'm going to choose adjoining.

Next I need to choose which of the message class inspectors to associate this form region with.  I'm going to choose IPM.Note.  Then I'll specify that I want this form region to show up on the Reading Pane and the inspector in Read mode but not compose as there won't be any message headers for that yet.  That's all the options I need to set and so I'll generate the code.

You can see that I have a FormRegion.vb file with the template for several methods created.  Now to show how much easier this is to use than manual form region creation I'm just going to run this without adding any functionality and you'll see that the form region we defined shows up attached to the correct inspector. 

Now all that's left for me to do is to add the functionality for the MessageHeader form region.  First I'll start by creating a couple of references to the controls on the form.  Next I'll cast those references to the actual controls in the OnInitialize method.  I want to be sure to clean up any references I have so in the OnClosing method I set the references to Nothing.  One of the functions built into the Form Region class is the IsVisible function which allows the developer to determine if the form region should be displayed for a specific item.  Here I'll use the existing functionality from the MSDN article by calling ShowRegionOnItem and passing in the Item object. 

Now that I've added the functionality I can hit F5 and run the add-in.  Here you can see the message header text is being displayed in the form region in the preview pane as well as in the inspector.  I can click on the Copy button and then bring up notepad and copy the message headers from the clipboard. 

One of the nicest features of a Form Region add-in is that it can host multiple form regions.  Here I'll add a new form region by click on "Add" and then "New Item" and you can see that Form Region appears in the list of items.  Selecting this starts the wizard again and I have to choose from the same options as before.  I'll attach this blank form region to a Contact inspector just to show that it works.  And Now I run this and voila two form regions hosted by the same add-in.

As you can imagine there is quite a few things going on behind the covers to make this all work.  I'm not going to go over all of that in this recording though, so if you just want to use Form Regions and don't care about the details then this is all you need to know.  Of course if you have any problems or questions feel free to email me at Paul.Ballard@BallardSoftware.com.

Thanks and Enjoy!


Click to download the installer for the RCPI Outlook 2007 Form Region Add-in templates.

8 Comments

  • Pretty cool add-in. This definitely makes building out form regions in your VS project easier. I noticed that some of the options for form regions aren't shown in the UI (no replace regions?). Is there a way to go set those properties using your add-in?

  • Wow, I completely forgot about Replace regions. In any case, in VS if you click the "Show all files" button you'll find the manifest file is nested underneath the FormRegion.vb file. You can change the RegionType to be Replace or ReplaceAll there and it should work. I'm going to do a video going over the details of how I've implemented the code in the next couple of days.

    If there are any other options that I've missed, let me know and I'll try to work them into a second (and probably final) release.

  • Hi,

    Where can I download the installer? The link at the end of the article refers to a web page where I couldn't find it. I searched for it and the only result refers to this web page.

    And one more thing - how to install the addin to Outlook after I've tested it and compiled it? What are the spets to be done?

    Thanks for the great video!

  • The URL should be fixed now. Thanks for the heads up!

  • Hi,

    thanks again for the stuff. Unfortunately, the separate mode for the form region did not work on my Outlook - the pane just didn't get replaced by my form.

    Anyway, I have another feature request - is it possible to make links from emails and RSS articles open in the reading pane, replacing the old content?

    This would be really useful for RSS articles without bodies - just with titles and reference to the web page, and links pople send me by mail.

    It should not be impossible, and really really useful!

    Thanks again!

  • Using "Separate" as the Form Region type won't have your new form region replace the old. This is a reference to the earlier comment on an option I left out of this version called "replace" or "replaceall". In order to try it in your application, just click on the "Show All files" button in Solution explorer and then expand the Form Region.vb file and edit the manifest directly changing the word separate to replace.

    As for your feature request, that sounds like a request for the Office team, I don't think you could pull that off effectively with a Form Region.

  • Hi Paul,

    I really like your template, but I've created a second form region under the contact message class for a separate add-in and all I can see is the previous one. Do you possibly know why this is happening? Is there some type of overlap with the naming of any of the objects when using your template for a second solution?

  • The naming of the FormRegion is actually a key to how the registry entries are linked to the manifest files and the OFS file. The default name for the first FormRegion in the template is "FormRegion". In your case, you've created two with the same name which is probably what it throwing off the registry and why Outlook isn't finding it.

    The solution is to go to either of your projects and just add a new Form Region naming it whatever you want and move your custom code to that FormRegion. You can then delete the one named "FormRegion" and both should be working.

Comments have been disabled for this content.