Sdílet prostřednictvím


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

Comments

  • Anonymous
    April 21, 2014
    I've seen that in OL2013 that the location where profile data is stored changed from "Windows NT" location in HKCR to now being under the Office key. Where will the outlook profile data be stored in C2R?  Same as a normal install? Or in the bubble?

  • Anonymous
    April 21, 2014
    Thanks, Stephen.  We've been impressed with how few (none, actually) problems we've had with C2R and our add-in/customs tore.

  • Anonymous
    April 21, 2014
    Eriq - the MAPI profile location did change in 2013, but as long as you're using the profile API, you won't notice a difference.

  • Anonymous
    April 21, 2014
    Thanks Steve.  I assumed as much, but my question was important for backing up profiles.  One task that we perform is to export an outlook profile to a .reg file. If the C2R location for profiles is different that other outlook installs, we'll need to know that.

  • Anonymous
    April 26, 2014
    Not a COM interface, but: For OL 2013 C2R, we use FGetComponentPath to get path for MAPISVC.inf. In a 64-bit OS with 32-bit click-to-run Outlook installed, we get correctly the default location for MAPISVC.inf - C:Program FilesMicrosoft Office 15rootvfsProgramFilesCommonX86SystemMSMAPI1033 However, attempting to install there, one would get redirected to: C:Program Files (x86)Microsoft Office 15rootVFSProgramFilesCommonX86SYSTEMMSMAPI1033 As a result, Outlook would not pick up our store ( as it does not pick up mapisvc.inf from the second location )

  • Anonymous
    March 02, 2016
    Is it possible to add an address book provider to Outlook 2013 click to run?I have used mfcmapi to confirm the profile path. I have opened that path, which has vfs in the middle.Mapisvc.inf is there. I can copy and paste the file. If I run a text editor as administrator I can open the file. But I can't save any changes. I read an article that refers to click to run running inside a bubble. So it makes sense that I can't change this file directly. Is there a way to change a file outside the bubble and have the change mirrored across?I am trying to add a small project to my solution which I can run when testing but also in the installer. This project will use the mapi stub library and Fgetcomponetpath to find the Mapisvc.inf.inf file. Hopefully there is also an api to add a service to the file. In the past I built different installers for each version of Outlook that would find and update Mapisvc.inf directly. This doesn't seem to work with Outlook 2013. Thanks for your time.

  • Anonymous
    May 04, 2016
    Does this also apply to Outlook 2016?

  • Anonymous
    January 13, 2017
    I was able to use IConverterSession MFCMapi.exe.x64.16.0.16319.01 in Win10 x64 with Office 2016 x64when registering the following classes. The MSG was an invitation. That maybe was the reason for the third classrem IConverterSessionreg copy HKLM\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Classes\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} HKLM\SOFTWARE\Classes\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} /s /frem IMimeMessagereg copy HKLM\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Classes\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} HKLM\SOFTWARE\Classes\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} /s /frem MapiCvt, may reopen MS07-003 !?!reg copy HKLM\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Classes\CLSID\{0006F085-0000-0000-C000-000000000046} HKLM\SOFTWARE\Classes\CLSID\{0006F085-0000-0000-C000-000000000046} /s /f