Eric Legault

Announcing our newest product: Add-in Express Regions for Microsoft Outlook and VSTO

We’re very pleased to announce the availability of the newest addition to our powerhouse line-up of leading edge, RAD development tools for building Microsoft Office solutions with Visual Studio: Add-in Express Regions for Microsoft Outlook and VSTO!!

Now, some of you may be wondering how this differs from Add-in Express for Microsoft Office and VSTO. We’re actually no longer selling that product, but don’t worry if you’re an existing customer as we’re definitely continuing to support it. However, with Add-in Express Regions for Microsoft Outlook and VSTO we have streamlined our previous VSTO solution into a tight little package of rockin’ extensibility that gives developers the power to implement what is arguably the most popular technology we’re currently offering. That technology is of course the ability to power up Advanced Form Regions for Outlook directly within your VSTO projects.

A quick walkthrough…

To illustrate how easy it is to add an Advanced Form Region, let’s go through the Wizards that’ll help you get up and running. If you want to follow along with Visual Studio 2010, start by creating a new Outlook 2010 VSTO add-in project, select “Add New Item” from the Project menu and choose an “ADX Region for Outlook and VSTO” item. This will add an ADXOlForm class to your project. This is really your Windows Form to build the custom UI for your region, but it inherits from the AddinExpress.OL.ADXOlForm class instead of System.Windows.Forms.Form.

Add new item dialog

Next, you’ll see the first screen of the New Add-in Express Region wizard:

New Add-in Express Region wizard - step 1

This screen is specific for Explorer windows (the main Outlook window), and allows you to choose from the numerous regions that we support via the Explorer layout drop down control. If you don’t want your Windows Form to be displayed in an Explorer window at all (or want to control its appearance dynamically in code), that’s fine – just leave it at “Unknown”.

New Add-in Express Region wizard - Bottom Reading Pane region

Once you’ve selected a layout type, notice that we are displaying a mock-up of an Explorer window, with the area to be extended highlighted in yellow (in this case we’re targeting ReadingPane.Bottom). One more thing though: make sure to select the item types that you want to support for your region (as per the Explorer item types list box, where I’ve selected MailItem only). All is good – so let’s go to the next dialog in the Wizard.

New Add-in Express Region wizard - step 2

This screen is specific to Inspector regions, but very similar to the previous dialog for Explorer regions. The key difference is the ability to choose the mode for your region via the Inspector mode checked list box. As any Outlook user is well aware, Outlook items live as new (compose) items or received (read) items.

The last screen of the wizard allows you to set the global properties for your region. Most of these properties should be fairly self-explanatory, but if you need more in-depth info please see our article Advanced Outlook view and form regions – Basic concepts.

New Add-in Express Region wizard - step 3

The “plumbing” behind the scenes…

So after we’ve merrily designed our region with the ALMIGHTY MAGICAL POWER OF OUR WIZARD, what exactly happened? Two important things: it added a new FormsManager module in our project (that extends the ThisAddIn class by adding the FormsManager property and OnInitialize event handler), and added just two lines of initialization code to the ThisAddIn class to wire it all up (see code examples below)! Let’s see a 60th level Mage in World of Warcraft do THAT!

VB.NET

Public Class ThisAddIn
 
    Private Sub ThisAddIn_Startup() Handles Me.Startup
 
        ' <auto-generated>
        ' Add-in Express Regions generated code - do not modify
        Me.FormsManager = AddinExpress.OL.ADXOlFormsManager.CurrentInstance
        Me.FormsManager.Initialize(Me)
        ' </auto-generated>
 
    End Sub
 
    Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
 
        ' <auto-generated>
        ' Add-in Express Regions generated code - do not modify
        Me.FormsManager.Finalize(Me)
        ' </auto-generated>
 
    End Sub
 
End Class

C#

public partial class ThisAddIn
{
    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
 
        #region Add-in Express Regions generated code - do not modify
 
        this.FormsManager = AddinExpress.OL.ADXOlFormsManager.CurrentInstance;
        this.FormsManager.OnInitialize +=
            new AddinExpress.OL.ADXOlFormsManager.
                OnComponentInitialize_EventHandler(this.FormsManager_OnInitialize);
        this.FormsManager.Initialize(this);
 
        #endregion
    }
 
    private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
    {
 
        #region Add-in Express Regions generated code - do not modify
 
        this.FormsManager.Finalize(this);
 
        #endregion
    }
}

The wizard has already setup much for you automatically, but if you ever want to change the behaviour of your form in any way, simply crack open the FormsManager file and change the property values in the OnInitialize event handler. Speaking of events, there is more than just the OnInitialize event, here are some of them:

  • ADXBeforeFormInstanceCreate
  • ADXBeforeFolderSwitchEx
  • ADXFolderSwitch
  • ADXFolderSwitchEx
  • ADXNewInspector
  • OnError

Many of these events are the key locations for controlling your region dynamically or for implementing your business logic.

That’s really all there is to it folks! So easy, yet so powerful, and a more than welcome addition to the arsenal of any developer in the ADX Army.

You may also be interested in:

Video: Ty Anderson introducing Add-in Express Regions for Outlook and VSTO

Post a comment

Have any questions? Ask us right now!