How to Enable your Document library open behavior for browser-enabled documents in SharePoint 2013?

In this article, we will talk about the open behavior of browser enabled documents in document library – SharePoint 2013. If you always want your document to opened in Client (i.e in your machine) rather than on your browser(web apps), please run the below the power shell code. The code is self explanatory.

 

(!(Get-PSSnapin “Microsoft.SharePoint.PowerShell” -ErrorAction SilentlyContinue))
{ Add-PSSnapin Microsoft.SharePoint.PowerShell }
$site1 = Get-SPSite (“https://ehsdev”)
$webapp = $site1.WebApplication

foreach($site in $webapp.Sites)
{
$site.AllWebs | foreach {
$web = Get-SPWeb -Identity $_.url
foreach($list in $web.Lists)
{
if ($list.BaseType -eq “DocumentLibrary” -and $list.BaseTemplate -eq “DocumentLibrary”)
{
Write-Host “Updating list $list on $($web.name)”
$list.DefaultItemOpen = “PreferClient”
$list.Update()
}
}
$web.Dispose()
}
}

The above code opens all the documents from your client machine rather than from browser.”PreferClient” is the property that should be used. There is another property called “Browser” which will enable your documents to be opened in web browser.

Happy SharePointing 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *