How To Set The Default Open Behavior Or Configure Office Files Opened By Default In SharePoint Online

This article is about “How to set the default open behavior or configure Office files opened by default in SharePoint online” in SharePoint site collection or in document library.

I will explain how we can configure the default open behavior for Office documents (browser or Application) in SharePoint site collections and document libraries.

This solution article applies to SharePoint online, SharePoint Server 2013, SharePoint Foundation 2013, and Office Web Apps.

So, let’s start with small description of how the default document behavior is there in the browser. As we know, we create a document library to store the documents like Word, Excel, PowerPoint etc. After configuring the SharePoint Server, clicking on any of the documents lets it open and the default behavior is set using the Server default, such as - open in browser or open in the Word Web app.

We can change the default behavior in three different ways.

  • SharePoint Farm (we can configure farm based behavior)

  • Site collection (Can be configured on site collection)

  • Document Library (one document library also can be configured for the same)

In the SharePoint Farm, we can configure or adjust the default open behavior of files on a file type basis. For example, Word, Excel, Notebook, and PDF behaviour can be set.

For this, we need to run a command

New-SPWOPIBinding
 
This command will create a new binding to associate file name extensions or applications with actions on the current SharePoint farm where this cmdlet is run.

The New-SPWOPIBinding cmdlet associates file name extensions or applications to actions on the current SharePoint farm where this cmdlet is run.

Syntax

New-SPWOPIBinding -ServerName "Prashant.spsolutions.com"

Above example creates bindings for all the applications and file name extensions that the WOPI application supports on the current SharePoint farm where this cmdlet is run.

For specific applications, we can run the below command

New-SPWOPIBinding -ServerName "Server.corp.Contoso.com" -Application "Excel"

To learn more about farm based changes for Office file behavior, visit the below URL.

https://technet.microsoft.com/en-us/library/jj219441.aspx

Don’t get confused. Once you have configured the farm based settings for Office files, you can remove the settings whenever you want. For further information, please visit the above URL.

We have another option to change the behavior in the site collection itself

Setup Office file behaviour in Site collection: SP administrators and users can use the OpenInClient feature in SharePoint online or 2013 to specify whether Office (Word, excel etc…) files will be opened in the client application or in the browser. Users (who have permission) can change this setting in the document library properties also for site collection administrators can change it in Site Collection Administration or by using the Enable-SPFeature cmdlet to enable the OpenInClient feature.

Below are the step by step solution with screen shots to the same

Note I am going to perform this on SharePoint Online, same steps will for SharePoint on-premises with some different GUI mode.

  • Login to the SharePoint online site collection with Admin rights.

  • Navigate the page to Site setting by clicking on Gear box on the top of page and Site collection features from site collection Administrator.

  • Now, click on highlighted site collection features and activate Open documents in client application by default.

  • By default, it will be deactivated. So, just click on "Activate" and wait for activation.



  • Once you're all done, go back to any document library and open the document to see the result; earlier it was opening in browser now it will prompt you to ask which application you want to use.

We can configure the above by using PowerShell command as well

  • Open SharePoint Online Management Shell and run the below command.

    Connect-SPOService -Url https://Spsolutions.sharepoint.com -credential [email protected]

  • Once entered, hit Enter. It will prompt you for password, enter the password and wait a second. 

  • It will connect your Office 365 site.

Note - Make sure, you have Admin rights to follow the steps, else you will be get access denied or a not authorized error.

  • Now, on the connected Office 365 site, run the below command.

    Enable-SPFeature 8A4B8DE2-6FD8-41e9-923C-C7C3C00F8295 -url <SiteCollURL (enter your site URL>

The above command is used to activate the feature for one site URL. If you wish to enable the same features for all site URLs, you need to run the below command.

Get-SPSite -limit ALL |foreach{ Enable-SPFeature 8A4B8DE2-6FD8-41e9-923C-C7C3C00F8295 -url $_.URL }

Last but not least, set the default open behavior for a document library by using the document library settings page.

This is very simple to set the behaviour for one particular document library. We can set behavior for Office documents in one document library as well, and it will take effect for all documents available in the same.

  • Open one document library and move your mouse cursor to "Documents" ribbon.

  • As SharePoint online keeps changing View, in the experienced View, we can click on "Site Setting" and select "Document settings" option.

  • It will take us to settings page's default view. Here, you need to scroll down to the page and select "open document in browser" option and select as per your wish to open your file.



  • Here, we can see default, use the server default (open in the browser). So, we need to select another option like "open in the client application"; and save this setting.

  • Now, go back to Library page and open any one document to test if the behaviour is working as expected or not. In my case, I have successfully changed the behaviour.

  • We can configure the same with Office 365 PowerShell Management shell also. Below is the command,

    Get-SPWeb -site <SiteCollURL> | % {$_.Lists} | where {$_.IrmEnabled -eq $true} | % {$_.DefaultItemOpen =[Microsoft.Sharepoint.DefaultItemOpen]::<DefaultItemOpenSetting>; $_.Update()}

*Change site collection URL on the colored object.

Thanks.