Of course, we can set the Browser File Handling to Permissive on the Web Application level (through Central Administration). This should work, but not in our case. It turns out some Document Libraries or Webs don’t feel like taking over this setting. Each list also has a Browser File Handling property.
A blog post by Kim Nguyen helped me in the right direction, all I had to do was modify her script to my wishes :)
The property to set: BrowserFileHandling
In PowerShell:
##
# Set BrowserFileHandling on all document libraries in all webs
##
param([string]$SiteName = “http://intranet”, $Path = “C:\PowerShell-Log.rtf”)
Start-Transcript -Path $Path -Append
$Site = Get-SPSite($SiteName)
# Root Web
$Web = $Site.OpenWeb()
Write-Host -BackgroundColor Magenta “Opening Web ” $Web.Url
foreach ($List in $web.Lists) {
Write-Host ” Opening List ” $List.Title
if($List.BaseType -match “DocumentLibrary”) {
if($List.BrowserFileHandling -eq “Strict”) {
$List.BrowserFileHandling = “Permissive”
$List.Update()
Write-Host -ForegroundColor Green ” BrowserFileHandling set to Permissive”
} else {
Write-Host -ForegroundColor Yellow ” BrowserFileHandling already set to Permissive”
} } else {
Write-Host -ForegroundColor Cyan ” List is not a Document Library (” $List.BaseType “)”
}
}
# Sub Webs
foreach ($Web in $Site.AllWebs) {
Write-Host -BackgroundColor Magenta “Opening Web ” $Web.Url
foreach ($List in $web.Lists) {
Write-Host ” Opening List ” $List.Title
if($List.BaseType -match “DocumentLibrary”) {
if($List.BrowserFileHandling -eq “Strict”) {
$List.BrowserFileHandling = “Permissive”
$List.Update()
Write-Host -ForegroundColor Green ” BrowserFileHandling set to Permissive”
} else {
Write-Host -ForegroundColor Yellow ” BrowserFileHandling already set to Permissive”
}
} else {
Write-Host -ForegroundColor Cyan ” List is not a Document Library (” $List.BaseType “)”
}
}
}
Stop-Transcript
Thanks for the shout-out! Glad the post was helpful. :-)
ReplyDelete