Outlook 2013 Click To Run and COM Interfaces

In this article I’ll go over the current state of Outlook 2013 Click To Run (C2R)and support for various programmatic interfaces. Please comment on any areas I’ve missed and I’ll update the article accordingly.

With Outlook 2013, we enabled something we had never supported before, side by side (SxS)  installation with other versions of Outlook. Specifically, we support installing Outlook 2013 side by side with Outlook 2010 or Outlook 2007. We do this by installing Outlook 2013 using Click-to-Run. For most MAPI applications and Outlook Add-Ins, C2R does not pose a problem. However, there is a small set of COM interfaces for which C2R creates an issue. We’ll go over them one by one.

Account Manager

This interface gave us the most trouble, but we’ve got it mostly fixed now. Let’s look at how the Outlook Account Manager, or CLSID_OlkAccountManager, caused a problem in the first place. This will also help us understand the remaining interfaces.

On a regular 64 bit installation of Windows with Outlook 2010 32 bit installed, we’ll find this interface registered here:

 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{ED475410-B0D6-11D2-8C3B-00104B2A6676}

The registration will tell COM where to find OUTLMIME.DLL, which actually implements the interface. On the same system, with Outlook 2013 C2R installed, we find this key instead:

 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\Wow6432Node\CLSID\{ED475410-B0D6-11D2-8C3B-00104B2A6676}

COM won’t ever know to look here. But when Outlook needs this interface it finds it. How? That’s part of the Click To Run application bubble. Applications outside the bubble see the normal registry. Applications inside the bubble see the normal registry, plus any registry keys mapped through the ClickToRun key. So when Outlook, which runs inside the bubble, looks for the class {4E3A7680-B77A-11D0-9DA5-00C04FD65685}, it has no trouble finding it. Other applications won’t see it though.

Outlook and Office register every class they expose inside the bubble. A few classes are also registered outside the bubble so that other applications can use them. So why don’t we just register CLSID_OlkAccountManager outside the bubble? We actually tried that. We took a fix to register this interface outside the bubble and found that Outlook 2010 clients started crashing. When Outlook 2010 tried to locate it’s own implementation of the Account Manager, it got Outlook 2013’s implementation, which promptly crashed. We had to pull this fix and be a little smarter about it. Now, C2R will only register this key outside the bubble if it detects that a previous version of Outlook isn’t already installed. This is the only interface we’ve done this for.

MAPI<->MIME

The MAPI<->MIME conversion interface, IConverterSession and the support interface it depends on, IMimeMessage, are also only registered inside the bubble. Several customers have chosen to fix this one by hand by copying the registrations from inside the bubble to outside. If the bitness of Outlook matches the bitness of the OS, you could do this as follows:

 rem For when the Office bitness matches Windows bitness:
rem IConverterSession
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} HKLM\SOFTWARE\Classes\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} /s /f
rem IMimeMessage
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} HKLM\SOFTWARE\Classes\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} /s /f

If the bitness differs:

 rem For Office 32-bit on Windows 64-bit:
rem IConverterSession
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\Wow6432Node\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} /s /f
rem IMimeMessage
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\Wow6432Node\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} /s /f

Only do this if Outlook 2013 is not installed side by side with another version of Outlook, or you risk breaking the older version of Outlook!

Also, note that this is why many of you have written to complain to me that MFCMAPI can no longer work with EML files with Outlook 2013 – you have Outlook 2013 C2R and it can’t work unless you patch up the registry.

MAPI Marshalling

Finally, there’s the little known/understood area of MAPI marshalling. This is an area we almost never see…except that Redemption depends on it. In this case, the problem isn’t that COM objects themselves aren’t registered (MAPI isn’t COM after all). The problem is that the proxy stub maps are hidden in the bubble. Dmitry and I worked together to come up with a .reg file to fix this one: https://groups.yahoo.com/neo/groups/Outlook-Redemption/conversations/topics/9600

The same warning about not doing this in a side by side scenario applies. Dmitry points out that we intend to fix this in the C2R installer. We did intend to fix it at the time Dmitry and I spoke, but after the problems we encountered with the Account Manager it became harder to justify these sorts of changes.

Resources