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: http://support.microsoft.com/kb/981242
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:
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.
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.
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 Client\OSD 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="c2r.microsoft.com/.../EssentialsC2R.de-de_14.0.5114.5002.sft" GUID="90140011-0062-0407-0000-0000000FF1CE" PARAMETERS="" FILENAME="%programfiles%\MCFMAPI.exe" SYSGUARDFILE="140062.deu\osguard.cp" SIZE="0"/>
<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 “HKLM\Software\Microsoft\SoftGrid\4.5\Client\Applications\” 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 Shared\Virtualization Handler\CVH.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 Shared\Virtualization Handler\CVH.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.
Awesome - I'll have to give this a try. I was kind of hoping this article would draw this sort of comment. Thanks!