Pieter van der Westhuizen

Office 2010 Solutions Module and Add-in Express 2010

I’m sure a lot of us use MS Outlook as our primary application when developing solutions hosted on the MS Office platform or when doing simple productivity enhancing add-ins. Using Outlook is an obvious choice, think about it. It is probably one of the few applications users always have open and use constantly each and every day. So naturally it was Northwind Traders’ (our fictional client for this development) number one choice as the primary application for their Customer, inventory and order management system.

If you have been developing MS Outlook Add-ins for a while, you most probably would have loved to have the ability to add you own pane /page to the left hand navigation pane. Unfortunately that request was something of a holy grail for Outlook developers prior to Outlook 2010. To work around that requirement, Outlook developers had to add their own folders to the existing navigation pane items. This worked to an extent but, speaking from experience, did confuse the users a bit on why there is a Northwind sub folder in their Inbox, and even worse if they already had a folder called Northwind, the add-in did unexpected things.

Well, something I am very excited about in Office Outlook 2010 is the new Solutions Module. This little gem allows developers to add their own pane /page to the Outlook 2010 Navigation Pane. Now, before you get too excited, this is only as long as it contains built-in Outlook items, e.g. calendar, tasks, mail and contacts.

Using Add-in Express 2010 Beta 2, I’ll show you how easy and quick it is to add you own Solutions Module. Let’s get started! Create a new ADX Add-in project or open your existing Northwind project.

Make sure you have the AddinModule designer open, and add a new ADXOLSolutionModule to your designer by either clicking on its toolbar button or selecting it from the designers’ context menu. In case you can’t find it, here’s an image:

Addin Module designer

Next, select the Solutions module component and click on ellipse (…) button next to the Folders property. Click on the Add Folder toolbar button as shown in the following image:

Solution Module folders collection

Change the FolderName property to Northwind and the FolderType to Notes. As you can see you have a list of the built-in Outlook items to choose from. Feel free to change the Image property if you want, then build and register your project.

Start-up Outlook and take a close look at the navigation pane. Notice a new item? If not, you might have to resize the navigation pane or select “show more buttons”. If all went well, your navigation menu should look something similar to this:

Outlook 2010 Navigation pane

You can set the location where the new item needs to be shown in the navigation pane by specifying the NavigationPanePostion property. Here is a screenshot of the result of setting the property to 1:

Custom solution module embedded into Navidation pane

Let us quickly go back to the AddinModule designer and add a few more folders according to the following structure:

  • Northwind
    • Sales
      • Customers
      • Contacts
      • Orders
    • Inventory
      • Product Categories
      • Products

    We’re going to use our own UI, so don’t worry too much about specifying the FolderType. The layout should look something like the following (I’ve added my own images for artistic effect):

    Navigation pane with custom solution module

    As mentioned previously, the Solutions module only supports the built-in Outlook items. You’ll notice when you click on Contacts, it will show you a standard Outlook Contacts item view. In this case we want our own forms to show. For example the Orders/Invoices should show the users a form to add /edit and search orders and invoices. Of course, we can accomplish this by using Add-in Express’ Outlook Forms Manager.

    I just want to stop right here, and highlight a “gotcha” with the Solutions module. If you go into Outlook and click on the Folders view, you will see the folder structure you’ve created under your Personal Folders or root folder (Thanks Dmitry for pointing me in the right direction!). Keep this in mind when you need to access certain folders in your Solutions module. Here is an image of what I mean:
    Folders structure

    OK, let us now add a new ADX Outlook Form item to your project and a new Outlook Forms Manager component to your AddinModule designer by clicking on the ellipse (…) button in its Items property. Click the Add button and set the ExplorerLayout property to WebViewPane. Set the FormClassName to the ADX Outlook Form you’ve added and specify the FolderName property. In my example it is Personal Folders\Northwind\Sales\Orders.

    Add any controls or logic you need onto the ADX Outlook Form, then build and register your project. Open Outlook and click on the Nortwind item in your navigation pane. If everything goes well, you should see something similar to this:

    Embedded .net controls for the custom folder

    How cool is that? Fine it is just a fancy view on a folder in your Personal Folders, but none the less, it will give your add-in a more professional look.

    Thank you for reading and until next time, keep coding!

    You may also be interested in:

22 Comments

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

    Is there a way to add more than one bar?
    Can the icon on the bar (the 3 cubes and a + sign) be changed?

  • https://secure.gravatar.com/avatar/e1a4c2b21a5186e0b27c1c601f418b76?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Ophir,

    Unfortunately, you cannot have more than one bar. As soon as you add more than one Solutions module, Outlook simply groups all the solution module folders under a single bar(navigation pane) called Solutions. Same goes for the icon, it appears we’re stuck with the 3 cubes and a plus sign :)

    Thank you for your comment.

    Kind Regards,
    Pieter

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

    In outlook 2010 with Exchange, the label “Personal Folders” in the above example reads “Mailbox – Erwin”… I have to specify “Mailbox – Erwin” as FolderName. How can this work for other users? Also, the order I specify for the folders (Sales/Customers/Orders etc.) gets reordered in Outlook 2010 in no apparent order.

  • https://secure.gravatar.com/avatar/e1a4c2b21a5186e0b27c1c601f418b76?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Erwin,

    “Mailbox – Erwin” is your DefaultStore name. In order to get it you can use the following code:

    Outlook.NameSpace nameSpace = OutlookApp.GetNamespace(“MAPI”);
    string defaultStore = nameSpace.DefaultStore.DisplayName;

    Not sure why you’re having trouble with the sort order. Outlook sorts folders alphabetically. If you create 3 folders on the same level e.g. Sales,Customers,Orders, Outlook will sort it Customers,Orders, Sales. However, if the root folder is Sales, and you add 2 subfolders, the subfolders will be sorted Customers,Orders.

    Hope this answers your question, thank you for your comment.

    Kind regards,
    Pieter

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

    Do you have a sample code for this topic. Where can i download? Thank you.

    Best regards,
    Melchor

  • https://secure.gravatar.com/avatar/e1a4c2b21a5186e0b27c1c601f418b76?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Melchor,

    I’ll create a sample add-in for you and let you know where to download it shortly.

    Regards,
    Pieter

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

    Pieter, I now have in InitializeComponent:

    Dim nameSpace2 As Outlook.NameSpace = OutlookApp.GetNamespace(“MAPI”)
    Dim defaultStore As String = nameSpace2.DefaultStore.DisplayName

    Me.AdxOlFormsCollectionItem1.ExplorerLayout =AddinExpress.OL.ADXOlExplorerLayout.WebViewPane
    Me.AdxOlFormsCollectionItem1.FolderName = defaultStore & “\AF Database\Sales\Customers”

    Which does not work. The whole solution does not show up anymore.

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

    Or putting this in AddinModule.New results in a NullReference:

    Dim oa As Outlook._Application = OutlookApp
    Dim nameSpace2 As Outlook.NameSpace = oa.GetNamespace(“MAPI”)
    Dim defaultStore As String = nameSpace2.DefaultStore.DisplayName

    Me.AdxOlFormsCollectionItem1.ExplorerLayout = AddinExpress.OL.ADXOlExplorerLayout.WebViewPane
    Me.AdxOlFormsCollectionItem1.FolderName = defaultStore & “\AF Database\Sales\Customers”
    Me.AdxOlFormsCollectionItem1.FolderNames.AddRange(New String() {defaultStore & “\AF Database\Sales\Customers”, defaultStore & “\AF Database\Sales\Customers\All Customers”, defaultStore & “\AF Database\Sales\Customers\My Customers”, defaultStore & “\AF Database\Sales\Customers\Recent Customers”})

  • https://secure.gravatar.com/avatar/70b9d8d2d8b0618036e606c4de7712f4?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Erwin,

    Sorry my mistake. I should’ve mentioned you need to put the code in the AddinStartupComplete event. So in C# the code will look like this:

    private void AddinModule_AddinStartupComplete(object sender, EventArgs e)
    {
    Outlook.NameSpace nameSpace = OutlookApp.GetNamespace(“MAPI”);
    string defaultStore = nameSpace.DefaultStore.DisplayName;
    NorthwindFormsCollection.FolderName = defaultStore + @”\Northwind\Sales\Orders”;
    Marshal.ReleaseComObject(nameSpace);
    }

    Hope this helps!

    Kind regards,
    Pieter

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

    That works like a charm, thanks!

  • https://secure.gravatar.com/avatar/70b9d8d2d8b0618036e606c4de7712f4?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Excellent!

    Let us know if there is anything else we can assist with.

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

    Can solution folders be added/removed dynamically?

  • https://secure.gravatar.com/avatar/e1a4c2b21a5186e0b27c1c601f418b76?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Opher,

    Yes you can, by using the following code:

    AddinExpress.MSO.ADXOLSolutionFolder newFolder = new AddinExpress.MSO.ADXOLSolutionFolder();
    newFolder.FolderName=”Northwind”;
    newFolder.FolderType = AddinExpress.MSO.ADXOLSolutionFolderType.Notes;
    adxolSolutionFolder1.Folders.Add(newFolder);

    Hope this helps!

    Kind regards,
    Pieter

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

    Hi, I try dynamically change in lFormsCollectionItem FormClassName but I don’t know how to refresh folder. Folder is refreshing only when I clicked to other folder. Do You have any idea?

  • https://secure.gravatar.com/avatar/e1a4c2b21a5186e0b27c1c601f418b76?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Jacek,

    Try the ApplyTo method of the FormsCollectionItem to refresh the form region. e.g:

    adxOlFormsCollectionItem1.FormClassName = “MyADXProject.NewFormRegion”;
    adxOlFormsCollectionItem1.ApplyTo(OutlookApp.ActiveExplorer());

    Good luck!

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

    You are my master !!! I was trying to achieve such an effect for several hours. THX

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

    Hi Pieter,

    This looks exactly like what I need.
    Have you created an example addin of this for download?
    Need to test and demo it.

    Kind regards,
    Dawie van Niekerk

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

    Pieter,

    I’m using “Add-in Express 2010 for Microsoft Office and VSTO, Standard”
    adxnet-v606-b4621-vsto-std

    Will this work on it or do I have to upgrade?

    Kind regards
    Dawie

  • https://secure.gravatar.com/avatar/e1a4c2b21a5186e0b27c1c601f418b76?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Dawie!

    The Solutions Module will work Add-in Express 2010 for Microsoft Office and VSTO, Standard.

    All the best.
    Pieter

  • https://secure.gravatar.com/avatar/e1a4c2b21a5186e0b27c1c601f418b76?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Dawie,

    I have one here somewhere :) Although, it was created using Add-in Express 2010 for Office and .net.
    I’ll e-mail it to you.

    Regards,
    Pieter

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

    Thanks Pieter,
    I’m createing the “Mother” folder with the designer. Then I want to be able to create the subfolders dynamically.
    My code doesn’t break and looks cool, but it doesn’t show my subfolder :-(
    I’m doing this:

    Dim newFolder As AddinExpress.VSTO.ADXOLSolutionFolder = New AddinExpress.VSTO.ADXOLSolutionFolder()
    newFolder.FolderName = defaultStore & “\Mother\Northwind”
    newFolder.FolderType = AddinExpress.VSTO.ADXOLSolutionFolderType.Notes
    AdxolSolutionFolder1.Folders.Add(newFolder)

    Dim AdxOlFormsCollectionItem3 As AddinExpress.OL.ADXOlFormsCollectionItem
    AdxOlFormsCollectionItem3 = New AddinExpress.OL.ADXOlFormsCollectionItem(Me.components)

    AdxOlFormsCollectionItem3.ExplorerLayout = AddinExpress.OL.ADXOlExplorerLayout.WebViewPane
    AdxOlFormsCollectionItem3.FolderName = defaultStore & “\Mother\Northwind”
    AdxOlFormsCollectionItem3.FormClassName = “MyVSTOAddin1.ADXOlForm1″
    AdxOlFormsCollectionItem3.UseOfficeThemeForBackground = True

    Marshal.ReleaseComObject([nameSpace])

  • https://secure.gravatar.com/avatar/e1a4c2b21a5186e0b27c1c601f418b76?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Dawie,

    You can add the child folders to the mother folders’ Folders collection. Do this in the AddinModule_AddinStartupComplete event :

    ‘ Root Folder
    Dim motherFolder As New ADXOLSolutionFolder()
    motherFolder.FolderName = “Mother”
    motherFolder.FolderType = ADXOLSolutionFolderType.Notes

    ‘ Child Folders
    Dim childFolder1 As New ADXOLSolutionFolder()
    childFolder1.FolderName = “Child1″
    childFolder1.FolderType = ADXOLSolutionFolderType.Notes

    Dim childFolder2 As New ADXOLSolutionFolder()
    childFolder2.FolderName = “Child2″
    childFolder2.FolderType = ADXOLSolutionFolderType.Notes

    ‘ Add Child Folders to MotherFolder
    motherFolder.Folders.Add(childFolder1)
    motherFolder.Folders.Add(childFolder2)

    ‘ Add Mother Folder to Solutions Module
    AdxolSolutionModule1.Folders.Add(motherFolder)

    Hope this helps!

Post a comment

Have any questions? Ask us right now!