Pieter van der Westhuizen

MS Outlook Advanced Regions, Folder Views and Add-in Express 2010

In this week’s post, we’ll build an add-in for Northwind Traders with which they will be able to set a different view on their Inbox in order to see a time-based view on when orders have been received. We’ll be using an advance forms region to give our users an easy-to-use interface.

Start by creating a new ADX COM Add-in Project in Visual Studio 2010.

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

Select Visual C# for our programming language and Microsoft Office 2010 as the Minimum supported Office version. For this example, only select Microsoft Office in the Supported Applications list. Finish the wizard and add a new ADX Outlook Form to the project.

Adding a new Add-in Express Outlook Form

This form will display a list of Northwind’s customers and the filter range for our Inbox.

Outlook Form to display a list of Northwind's customers

Next, switch to the AddinModules’ designer and add a new ADXOutlookFormsManager.

Adding a new ADXOutlookFormsManager

Select the ADXOutlookFormsManager and click the ellipses (…) button next to its Items property. Add a new item to the forms collection by clicking the Add button. Change the ExplorerItemTypes property to Mail and the ExplorerLayout property to BottomNavigationPane. Select the ADXOutlook Form you’ve added earlier from the list of items in the FormClassName property. Click the OK button to close the Forms Collection Editor window.

To save time, we’ll create the view for the folder in Outlook and filter the view in our add-in. To create the view, select Manage Views from the Change Views menu in Outlook:

Creating the view for the Outlook folder

Create a new View, and set the type of view to Day/Week/Month. Name the view InboxCalendarView.

Add the following code to the ADX Outlook form’s Set Filter button:

private void btnSetFilter_Click(object sender, EventArgs e)
Outlook._Explorer myExpl = (Outlook._Explorer)this.ExplorerObj;
Outlook.MAPIFolder currFolder = (Outlook.MAPIFolder)myExpl.CurrentFolder;
String viewXml = currFolder.CurrentView.XML;
XmlDocument xmlDoc = new XmlDocument();
XmlNode rootNode = xmlDoc.DocumentElement;
XmlNode filterNode = rootNode.SelectSingleNode("filter");
if (filterNode != null)
    filterNode.InnerText = "urn:schemas:httpmail:sender LIKE '%" + cboCustomers.Text + "%'";
    filterNode.InnerText += "AND %" + cboReceived.Text.ToLower() + "(urn:schemas:httpmail:datereceived)%";
    XmlElement filterElement = xmlDoc.CreateElement("filter");
    filterElement.InnerText = "urn:schemas:httpmail:sender LIKE '%" + cboCustomers.Text + "%'";
    filterNode.InnerText += "AND %" + cboReceived.Text.ToLower() + "(urn:schemas:httpmail:datereceived)%";
currFolder.CurrentView.XML = xmlDoc.InnerXml;

To see a list of all fields available  when specifying the urn:schemas:httpmail, see:

urn:schemas:httpmail: Namespace on MSDN

After building and running the solution, start MS Outlook. You will see an advanced Outlook region below the navigation bar.

Advanced Outlook region below the navigation bar

The Customer combo box will show a list of Northwind’s customers. When the user clicks the Set Filter button, the current selected folder will only display mail items from the selected customer received within the selected timeframe. If you selected the InboxCalendarView we’ve created earlier, your folder view will look like this:

Custom Outlook calendar view

Now, the Northwind sales representatives can easily see when they received emails from specific customers.

Thank you for reading. Until next time, keep coding!

You may also be interested in:

Advanced Outlook view and form regions – Basic concepts
Advanced Outlook view and form region types


  • https://secure.gravatar.com/avatar/0ada71527ef17d43684fd4efc6c7b366?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Sourabh nagar says:

    I don’t see adx com addin for visual studio 2010 under extensibility.. How do I activate it?

  • https://secure.gravatar.com/avatar/bbd979ae5b772d0bc1f82065aa4ba146?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Eugene Astafiev says:

    Hi Sourabh,

    Please make sure that you have Add-in Express for Office and .net installed on your PC.

Post a comment

Have any questions? Ask us right now!