Rather that trying to release and explain my other apps I thought I would write a event sync for outlook that uses WPF for the UI. I will be doing my best to use the MVVM pattern as well.

Requirements:

Credits:

 Steps:

  1. Create a new Outlook 2007 Add-in.
  2. Add the following References:
    PresentationCore
    PresentationFramework
    WindowsBase
    WindowsFormsIntegration (needed to host a WPF control in a outlook inspector)
    JakeOutlookToolkit
  3. Add this code to your ThisAddIn_Startup method.
    if (System.Windows.Application.Current == null)    new System.Windows.Application { ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown };

     
    WPF requires the Application to be instantiated, it is a singleton so it only needs to be instantiated on load then you can reference it anywhere by using Application.Current.
     
    The shutdown mode was added because if I showed a WPF window, then the user closed it Outlook would crash the next time you tried to show a WPF window.

What’s in the toolkit

The toolkit is a collection of classes I have put together and modified for my own use. It contains:

  • An Outlook folder monitor (with add, modified and deleted events you can subscribe to)
  • ItemAdapter, provides a common wrapper for outlook items, AppointmentItems, MailItems etc only have a single common interface (ItemEvents_10_Event), the ItemAdapter gives you Save, Delete, Display, OnOpen, OnWrite, OnClose events and properties which reduces casting and allows us to be more generic with our outlook app.
  • Menu, CommandBar, CommandBarManager. A really nice way to work with office toolbars, it automatically subscribes to new explorers and attaches any registered command bar etc. Very handy.
  • And a few other little things that I find useful.

 

We now have the shell of our app, I will be aiming to get this app done this weekend.

I will attach the source of the project once I finish the next part.