Sunday, July 1, 2012

SharePoint 2010 users are prompted to save PDF file instead to open directly issue

In SharePoint 2010, users are prompted to save PDF files instead of opening directly when they try to open the files on some libraries.
SharePoint 2010, there is a setting called “Browser File Handling” control this behavior. This setting has 2 options:
Strict: specifies that MIME content types which are not listed in “AllowedInlineDownloadedMimeTypes” are forced to be downloaded.
permissive:“Permissive” specifies that the HTML and other content types which might contain script are allowed to be displayed directly in the browser. (You need to select this option to solve this)

This setting can be configured in web Web Application level.or Library level.
You can modify setting on web application level through GUI For that you need to be a Farm Administrator. Steps to change Browser File Handling property:
  • 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
There is no UI to change this setting in library level. You can use powershell:

      Add-PSSnapin Microsoft.SharePoint.Powershell
      $site = Get-SPSite("http://sbx01/sites/Harry")
      $web = $site.OpenWeb()
      $list = $web.GetList("http://sbx01/sites/Harry/Shared Documents")
      $list.browserfilehandling                       //list the value “Strict” is the return for example

     $list.browserfilehandling = "Permissive"
     $list.update()                                             // set the value to “Permissive”
     $list.browserfilehandling                      // list the value again 

No comments: