MAPI And Virtualization

I promised before that I would take an in depth look at Click-to-Run and MFCMAPI. I’ve done so and the results are mixed. I couldn’t find a way to launch MFCMAPI on its own into the virtual environment, but I did find a trick to load it along side Outlook.

Click-to-Run, described here is a mechanism for delivering Office to client machines. It’s built on top of App-V (formerly SoftGrid). Using Click-to-Run, you can stream Office to a client machine (so that you can run it while it’s still installing) and it also runs virtually, reducing the number of co-existence scenarios. Enterprises can use this to reduce installation, support, and upgrade costs. We even use it to deliver trial versions of Office 2010.

The virtualization behind Click-to-Run is the source of the problem we have with MAPI. Since MAPI is installed by Outlook, and since Outlook is virtualized, applications running outside the Click-to-Run don’t have access to MAPI. We describe what does and doesn’t work here:

MFCMAPI falls in the “doesn’t work” category, but that doesn’t mean there aren’t tricks you can use. In the previous post, Kevin noted that he could use an Outlook 2010 Add-in to launch MFCMAPI inside the virtual environment. This will work, but I found another trick: use a little known feature of the File/Open dialog.

Here’s the trick as I perform it:

  1. Open Outlook Data File - File/Open/Open Outlook Data File
  2. Navigate to c:windowssystem32
  3. Select "All Files" from the file type dropdown.
  4. Locate cmd.exe, right click, and select Open.
  5. The command prompt is now running in the virtual environment. Cancel Outlook Data File dialog.
  6. Run MFCMAPI from the command prompt.

The advantage of doing the trick this way is you don’t have to install anything special to make it work. Also, once you have the command prompt open, you can run any application you want from inside the virtual environment, not just MFCMAPI.

Some caveats:

  • This trick obviously only works if Outlook is running. If you’re having trouble getting Outlook to log on and you wanted to use MFCMAPI to look at the profile, you may be out of luck. Of course, you could always try building a new profile using the Mail Control Panel and using that profile to get in to Outlook, and then do your troubleshooting.
  • If you close Outlook, I think your command prompt and anything launched from it will also be closed. If you have multiple virtual Office application installed, you might try doing the trick from one of the other Office applications and leaving it open, allowing you to open and close Outlook.
  • If you have a policy applied which doesn’t allow you to create PSTs, you can’t use that entry point into the File/Open dialog. You might try using Attach File from a mail message instead.
  • The ideal fix here would be to add MFCMAPI (or whatever MAPI based application you need to run) to the virtual environment. This involves a lot of stuff about App-V that I just don’t understand. Until someone shows me it can be done, I’ve concluded it’s impossible. 🙂

If I haven’t been clear – this is a trick to getting MFCMAPI to run in this environment. It’s not supported and not guaranteed to work. Use at your own risk.


Comments (2)

  1. Georg says:


    adding MFCMAPI to the virtual environment is possible. I don’t have any clear knowledge about App-V, I’ve just tried to add our own program to the virtual office environment several month ago.

    Because you have to reuse the already sequenced Office installation and no configuration program comes with Office, I could only make it work by manually creating some *.osd file and edit the registry. There might be easier ways to configure it I’m not aware of.

    The basic steps are:

    1. Create an *.osd file based on one of the Office *.osd files. The *.osd files are containing the configuration of the virtual environment. These files can be found in the common document directory (in “SoftGrid ClientOSD Cache”). I.e. copy the *.osd of Outlook (in my case it was 5bb30d21-8445-4035-86ed-b9948d36bb01.osd) and edit it for use with MFCMAPI.exe. The result will look something like the following:

    <SOFTPKG GUID="6D3D9E99-82C1-463a-B838-91DABAD5ACE2" NAME="MFCMAPI” VERSION="9014006204070000">


           <CODEBASE HREF="…/" GUID="90140011-0062-0407-0000-0000000FF1CE" PARAMETERS="" FILENAME="%programfiles%MCFMAPI.exe" SYSGUARDFILE="140062.deuosguard.cp" SIZE="0"/>








           <VM VALUE="Win32">

               <SUBSYSTEM VALUE="console"/>






       <SUITE NAME="Microsoft Office Home and Business 2010 – Deutsch"/>


       <ABSTRACT>Office 14 Click-2-Run image produced by XMLEncoder</ABSTRACT>


    In this example I have just replaced the name and the filename attribute to point to MFCMAPI. The path has to be adjusted of cause. Additionally I guess the GUID must be something unique, so I created a new one here. The attributes for version, href and sysguardfile must match the ones of Office.

    2. Create a new registry key in “HKLMSoftwareMicrosoftSoftGrid4.5ClientApplications” with the name and version of the virtual MFCMAPI as specified in the osd file. For the above *.osd file the key should be named “MFCMAPI 9014006204070000 ”. In this key create an entry “DescriptionURL” pointing to the newly created *.osd file.

    3. Restart the “Application Virtualization Client” (and its dependent) services to apply the new registry settings. Note: This will force any virtual application currently running to quit!

    4. To start MFCMAPI within the virtual environment, use the following command line:

    "% commonprogramfiles %Microsoft SharedVirtualization HandlerCVH.EXE" "MFCMAPI 9014006204070000"

    This last parameter points to the newly created registry key which in turn references the *.osd file to find MFCMAPI.exe.

    There is another easier way to use MFCMAPI (or any other MAPI program) inside the virtual environment. Office 2010 comes with an virtual command prompt which just starts cmd.exe within the virtual environment. This can be used to start any program as MFCMAPI.

    Just use the following command line i.e. in a shortcut (the path to MFCMAPI has to be correct of cause):

    "%commonprogramfiles%Microsoft SharedVirtualization HandlerCVH.exe" "Virtual Command Shell 9014006204070000" /c start "" /B "MFCMAPI.exe"

    The only drawback is an opening cmd window – but it will be closed as soon as MFCMAPI is running.



  2. Awesome – I'll have to give this a try. I was kind of hoping this article would draw this sort of comment. Thanks!

Skip to main content