Home > Powershell, SharePoint > Opening .msg e-mails in Outlook from a SharePoint 2010 document library.

Opening .msg e-mails in Outlook from a SharePoint 2010 document library.

Out of the box, if you attempt to open a .msg file from a document library you’ll notice that IE only offers the choice to save this file or cancel.  This behaviour is caused by SharePoint 2010’s Browser File Handling and is set per Web Application.  There are two options, Strict which specifies that MIME types not listed in “AllowedInlineDownloadedMimeTypes” are forced to be downloaded and Permissive which permits all MIME types to be opened in the browser.

There are two ways to permit SharePoint 2010 to serve .MSG files so they can be opened from the browser.

Option 1:

The first option is a rather brute force approach since it involves changing the default file handling from Strict to Permissive which effectively allows any file types for that on web application level to be opened in the browser and not just .MSG files.  This is achieved by the following procedure:

  • Go to SharePoint 2010 Central Administration > Application Management > Manage Web Applications
  • Select the row of your web application
  • Click General Settings in the ribbon
  • Scroll down to Browser File Handling and select Permissive
  • Click OK
Recycle the Application Pool for the Web Application on each of your web front end servers and you will now be able to open .MSG or .PDFs or any other file type directly in the browsers from a SharePoint document library.

Option 2:

This is my preferred method, it’s more involved but means the Strict browser file handling remains in place.  First of all you need to add the correct MIME type to IIS for .msg files on each of your front end servers as it’s not present out of the box.

  • Start Internet Information Manager
  • Select the server node in the left pane, however this can be done on a per web application basis if required.
  • Open in the MIME Types settings, click add.
  • Enter .msg for file name extension and application/vnd.ms-outlook
IIS 7 Mime setting for .msg files
  • Repeat for all front end servers
Next you need to run the following Powershell in the SharePoint Management Shell on a single server in the farm.  First replace YOUR WEB APPLICATION at the top of the script with the URL of your Web Application.
$webApp = Get-SPWebApplication http://YOUR WEB APPLICATION
If ($webApp.AllowedInlineDownloadedMimeTypes -notcontains "application/vnd.ms-outlook")
  Write-Host "application/vnd.ms-outlook added to AllowedInlineDownloadedMimeTypes"

You now need to run IISRESET on each web front-end server for these settings to be applied.

If you’re looking to do the same for PDFs then the MIME type already exists in IIS, so just amend the powershell script for the MIME Type:  ‘application/pdf’

Categories: Powershell, SharePoint
  1. September 20, 2011 at 3:58 pm

    Hello Ian,

    I’ve completed the required steps, but I still do not get .msg files to open directly within the browser or the client application. PDF works without problems. Also opening .msg files with Browser File Handling in Permissive mode is working like it should.

    Current settings used are that .msg is added to the current web site’s MIME Types in INETMGR (extension: “.msg”, MIME Type: “application/vnd.ms-outlook”). Also “application/vnd.ms-outlook” is in the current web application’s AllowedInlineDownloadedMimeTypes.

    I’ve tried to access the site both locally and remotely, which both results in only a save file dialog (except when in permissive mode).

    Can you think of any other setting that might affect that .msg cannot directly be opened in the client application.

    Thank you in advance.

    • September 21, 2011 at 10:55 am

      Hi Jouni,

      I’ve applied this process to several environments and it works well. However, I’ve just followed the post myself on a fresh environment to check out the post and there is one small omission. After running the PowerShell script you will need to run IISRESET on all Web Front-ends. I’ve updated the post to reflect this now.

      To ensure the you have this MIME type added to SharePoint, try the following the Management Console but, change the Web Application value to match your environment. Newly added MIME types will appear at the end of the list as it is not sorted by default.

      $webApp = Get-SPWebApplication http://intranet

  2. Ly Tang
    January 27, 2012 at 12:25 am

    Reblogged this on dev.notes.share().

  3. May 16, 2012 at 9:15 pm

    I have single SPS 2010 where I set web application to Permissive Mode, now PDF loads in browser but still not .MSG file… any idea ?

    • May 19, 2012 at 9:14 pm

      Have you followed the post and added the MIME type to IIS?

  4. May 23, 2012 at 12:58 pm

    Is there any way to manual insert the mime type in SP xml file ? as I am not feeling comfort in using Shell command.

  1. January 18, 2012 at 4:59 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: