• Sign in
 
  •  
  • MSDN Blogs
  • Microsoft Blog Images
  • More ...

  • Blog Home
  • About
  • Email Blog Author
  • Share this
  • RSS for posts
  • Atom
  • RSS for comments
  • CDO (26)
  • Code Snippet (43)
  • Custom Providers (17)
  • Debugging (8)
  • DevMsgTeam (317)
  • Documentation (117)
  • DST (8)
  • EWS (8)
  • Exchange (115)
  • Gotchas (102)
  • Hotfix (29)
  • MAPI (254)
  • MAPI Download (56)
  • MFCMAPI (107)
  • MSDN (59)
  • Non Dev (11)
  • OOM (17)
  • Outlook (182)
  • Outlook 2007 Auxiliary Reference (45)
  • Outlook Integration API (12)
  • Protocol Docs (20)
  • PST/OST (24)
  • Referrals (8)
  • Vista (12)
  • WrapPST (19)
Links:
  • Download MFCMAPI
  • MFCMAPI on Facebook
  • Troubleshooting Outlook Crashes
  • Office Update Center
  • Developer Messaging Team Blog
This site is provided "AS IS" with no warranties, and confers no rights. Use of included code samples are subject to the terms specified in the Terms of Use.
Archives
  • August 2014 (1)
  • May 2014 (2)
  • April 2014 (1)
  • March 2014 (1)
  • February 2014 (1)
  • January 2014 (2)
  • December 2013 (2)
  • November 2013 (2)
  • October 2013 (2)
  • August 2013 (2)
  • May 2013 (5)
  • April 2013 (1)
  • March 2013 (2)
  • February 2013 (2)
  • January 2013 (2)
  • December 2012 (4)
  • November 2012 (2)
  • October 2012 (2)
  • September 2012 (1)
  • August 2012 (3)
  • June 2012 (2)
  • May 2012 (1)
  • April 2012 (3)
  • March 2012 (3)
  • February 2012 (3)
  • January 2012 (1)
  • December 2011 (3)
  • November 2011 (1)
  • October 2011 (3)
  • September 2011 (1)
  • August 2011 (1)
  • July 2011 (4)
  • June 2011 (3)
  • May 2011 (3)
  • April 2011 (3)
  • March 2011 (5)
  • February 2011 (1)
  • January 2011 (2)
  • December 2010 (1)
  • November 2010 (4)
  • October 2010 (1)
  • September 2010 (3)
  • August 2010 (5)
  • July 2010 (3)
  • June 2010 (3)
  • May 2010 (1)
  • April 2010 (3)
  • March 2010 (3)
  • February 2010 (3)
  • January 2010 (2)
  • December 2009 (3)
  • November 2009 (5)
  • October 2009 (4)
  • September 2009 (5)
  • August 2009 (5)
  • July 2009 (11)
  • June 2009 (6)
  • May 2009 (5)
  • April 2009 (3)
  • March 2009 (18)
  • February 2009 (10)
  • January 2009 (3)
  • December 2008 (2)
  • November 2008 (2)
  • October 2008 (5)
  • September 2008 (4)
  • August 2008 (10)
  • July 2008 (6)
  • June 2008 (8)
  • May 2008 (2)
  • April 2008 (4)
  • March 2008 (2)
  • February 2008 (2)
  • January 2008 (5)
  • December 2007 (3)
  • November 2007 (2)
  • October 2007 (3)
  • September 2007 (1)
  • August 2007 (4)
  • July 2007 (5)
  • June 2007 (3)
  • May 2007 (4)
  • April 2007 (1)
  • March 2007 (6)
  • February 2007 (3)
  • January 2007 (2)
  • December 2006 (4)
  • November 2006 (3)
  • October 2006 (1)
  • August 2006 (1)
  • June 2006 (5)
  • May 2006 (5)
  • December 2005 (1)
  • November 2005 (4)
  • October 2005 (2)
  • September 2005 (1)
  • April 2005 (3)
  • December 2004 (2)
  • September 2004 (2)
  • August 2004 (3)
  • July 2004 (3)

MAPI And Virtualization

MSDN Blogs > SGriffin's MAPI Internals > MAPI And Virtualization

MAPI And Virtualization

Stephen Griffin - MSFT
3 Mar 2011 5:31 AM
  • Comments 2

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:

  1. Open Outlook Data File - File/Open/Open Outlook Data File
  2. Navigate to c:\windows\system32
  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.

Enjoy!

  • 2 Comments
Outlook, MAPI, Gotchas, MFCMAPI, DevMsgTeam, C2R
Comments
  • Georg
    1 Apr 2011 7:37 AM

    Hi,

    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">

       <IMPLEMENTATION>

           <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"/>

           <WORKINGDIR>%SYSTEMROOT%</WORKINGDIR>

           <VIRTUALENV TERMINATECHILDREN="FALSE">

               <ENVLIST/>

               <POLICIES>

                   <LOCAL_INTERACTION_ALLOWED>TRUE</LOCAL_INTERACTION_ALLOWED>

               </POLICIES>

           </VIRTUALENV>

           <VM VALUE="Win32">

               <SUBSYSTEM VALUE="console"/>

           </VM>

       </IMPLEMENTATION>

       <DEPENDENCY>

           <CLIENTVERSION VERSION="4.5.0.376"/>

       </DEPENDENCY>

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

       <TITLE/>

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

    </SOFTPKG>

    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.

    Regards,

    Georg

  • Stephen Griffin - MSFT
    1 Apr 2011 7:53 AM

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

Page 1 of 1 (2 items)
Leave a Comment
  • *
  • * Please enter a comment Please shorten the content to 3072 or less
  • *Please add 7 and 6 and type the answer here:
  • Post Publishing An error occurred while posting! Please retry posting your comment.
  • © 2014 Microsoft Corporation.
  • Terms of Use
  • Trademarks
  • Privacy & Cookies
  • Report Abuse
  • 5.6.426.415