Pieter van der Westhuizen

How to highlight Outlook forms programmatically

Version 6.3 of Add-in Express for Office and .net provides us with a new method to highlight form regions in Microsoft Outlook. Let’s test the new method by creating a new Visual Studio 2010 ADX COM Add-in project.

Creating a new ADX COM Add-in Project in Visual Studio 2010

Select Microsoft Outlook as the Supported Applications and finish the New Microsoft Office COM add-in Wizard.

Select Microsoft Outlook as the Supported Applications

Add an ADXRibbonTab and ADXOutlookFormsManager component by clicking on the respective toolbar icons.

Adding ADXRibbonTab and ADXOutlookFormsManager components

Next, add a new ADX Outlook Form to your project by selecting Add New Item… from the Visual Studio Project menu and selecting the ADX Outlook Form item.

Adding a new ADX Outlook Form

Switch back to the AddinModule designer surface and select the ADXOutlookFormsManager component. Add a new item to its forms collection and set the following items’ properties to:

  • AlwaysShowHeaderTrue
  • ExplorerItemTypesMail
  • ExplorerLayoutBottomNavigationPane
  • FormClassNameTo the ADX Outlook Form you’ve added earlier

Select the RibbonTab component, and change its design to resemble the following image:

Changing the design of the RibbonTab component

Add the following code to the ribbon button’s OnClick event:

private void adxHighlightRegionRibbonButton_OnClick(object sender,
         AddinExpress.MSO.IRibbonControl control, bool pressed)
        {
            AddinExpress.OL.ADXOlForm myRegionForm = adxOlFormsCollectionItem1
                .GetCurrentForm(AddinExpress.OL.EmbeddedFormStates.Active);
 
            if (myRegionForm == null)
            {
                myRegionForm = collectionItem.GetCurrentForm(AddinExpress.OL.EmbeddedFormStates.Visible) as MyOutlookForm;
            }
 
            myRegionForm.Highlight();
        }

Did you notice we used the ADX Outlook Forms’ Highlight method?

Now, all you have to do is build, register and run your project.

Start Microsoft Outlook and if all went you should see the form region below the navigation pane well, its state is currently minimized. You should also see the Highlight Region tab. Click the Highlight my Region button and the region’s header will blink 5 times and remain highlighted until the region becomes active. You can activate the region by clicking on it.

Highlighted header of the minimized Outlook region

Expand the form region by clicking the two up arrows icon, its state will then be Normal, and click the Highlight my Region button again and you’ll notice that even when visible, the form region’s header will blink when calling its Highlight method.

Highlighted header of the normal Outlook region

Next, double click on the splitter bar above the region’s header; this will set the region’s state to hidden, meaning you will only see the splitter bar and not the header. Click the Highlight my Region button again. You will notice that the splitter bar will blink 5 times and stay highlighted until you activate the region by either double-clicking on the splitter bar again or anywhere on the region itself.

Highlighted splitter bar of the hidden Outlook region

Thank you for reading. I hope this new feature will help you provide your users with an even more intuitive Microsoft Outlook add-in.

Until next time, keep coding!

You may also be interested in:

Post a comment

Have any questions? Ask us right now!