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
- 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.
1 | $webApp = Get-SPWebApplication http://YOUR WEB APPLICATION |
2 | If ($webApp.AllowedInlineDownloadedMimeTypes -notcontains "application/vnd.ms-outlook") |
3 | { |
4 | $webApp.AllowedInlineDownloadedMimeTypes.Add("application/vnd.ms-outlook") |
5 | $webApp.Update() |
6 | Write-Host "application/vnd.ms-outlook added to AllowedInlineDownloadedMimeTypes" |
7 | } |
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’
Controle
$webApp = Get-SPWebApplication http://webapplicationname
$webApp.AllowedInlineDownloadedMimeTypes
}
No comments:
Post a Comment