Wednesday, January 23, 2013

SharePoint 2010 - Browser File Handling Bug

There is a flag web application level that allows you to manage how SharePoint 2010 handles opening of documents other than Office.

You can force the download on the client (strict mode - this is the default) rather than directly open the document (permissive).

The setting works as described except that in a case:

- The document library is created from a site template (wsp solution).

In this case, all Document Library in the instanziated site have the property "BrowserFileHandling" set to Strict, ignoring the settings of the webapplication.

With this simple powershell script to run through the SharePoint Management Shell, you can reset all the document library of all the web for a specific site collection to the desired behavior.



$site=Get-SPSite http://sitecollectionurl
$webs=$site.AllWebs


foreach($web in $webs)
{
 $web

 foreach($list in $web.Lists)
 {
  $list.BrowserFileHandling = "Permissive"
  $list.Update()
 }
}
 
 

No comments: