Opening Office Documents in Client Applications Instead of the Browser

At Sympraxis, we work with organizations in a wide variety of industries. That’s one of the reasons we love working with SharePoint and Office 365 – there are no vertical focuses required. Organizations of just about every size and shape use these platforms, which makes life much more interesting.

That said, people in different industries expect different capabilities in the Office applications. While the browser version of Word or Excel is more than adequate for many people, for some organizations who need the more complex capabilities the browser versions fall short. Unfortunately, it can be very simple things sometimes, like working with headers and footers in Word. The online version of Word just doesn’t do this well – yet.

In the cases where an organization chooses to stick with the desktop applications – either because of specific needs or just because change is hard – there are several ways to change the behavior of opening a document from a SharePoint Document Library.

The simplest approach is to just change the behavior through the Library Settings. In Advanced settings, you have three options:

  • Open in the client application 
  • Open in the browser 
  • Use the server default (Open in the browser)

The first two options are pretty self explanatory. The third is more complicated.

Note:

All of this applies to Office documents: Word, Excel, PowerPoint, etc. PDFs are a whole other ball of wax. I may address them in a future post, but know they are different.

The third option is the default, and if you haven’t made any other changes, it will read Use the server default (Open in the browser).

Use the server default

If you want documents in the specific Document Library to open in the client application – this means Word or Excel on your local machine – then you can select that and it’ll work.

Open in the client application

But this is a very local solution – it applies only to the one Document Library. If you want to open documents in the client applications more broadly, you’ll want to turn to some automation. That means PowerShell.

Here’s an example showing how you might change the setting for a Document Library to open documents in the client applications. The example does this for the Documents library in one site. Obviously, you could add an outer loop to apply the change to multiple sites. You could also change the Where-Object clause to change the setting in more than one Document Library in the site.

$siteURL = "https://mytenant.sharepoint.com/sites/siteName/" 
Connect-PnPOnline -Url $siteURL 

# Open documents on the client
$web = Get-SPWeb -site $siteURL
foreach ($spList in $web.Lists | Where-Object { $_.Title -eq 'Documents' } ) {
    $spList.DefaultItemOpen = [Microsoft.Sharepoint.DefaultItemOpen]::PreferClient
    $spList.Update()
}

In the example, I’m setting the DefaultItemOpen property to PreferClient. This means the documents will be opened in the client applications.

There are two important properties for each SharePoint Document Library. Because there are two of them, thinking it through is a little more complex.

  • DefaultItemOpen – The enumeration for this property is effectively boolean. It can either be Browser (1) or PreferClient (0)
  • DefaultItemOpenUseListSetting – This property can either be True or False (truly boolean).

These two properties are what allows us to have three settings using boolean values. (It’s not how I would have built things, but here we are.)

If DefaultItemOpenUseListSetting is True, then the first two options come into play for the Document Library.

  • Open in the client application 
  • Open in the browser 

If DefaultItemOpenUseListSetting is False, then the third option is used:

  • Use the server default (Open in the browser)

That third option can either be:

  • Use the server default (Open in the browser) or
  • Use the server default (Open in the client application)

How might that change, you might ask? Well, there’s another option available here. There’s a Site Collection Feature called Open Documents in Client Applications by Default. This is where the so-called “server default” value comes from. It’s not actually at the “server” level (I’d expected a Tenant or Farm level setting, but as far as I can determine, there isn’t one.), but at the Site Collection level. There *may* be a setting at the Web Application level in older (pre-2019) versions of SharePoint, but I haven’t confirmed this.

Open Documents in Client Applications by Default

If you’ve activated this feature, you’ve said “I want all documents in the Site Collection to open in the client applications.” (Yes, that’s Site Collection, not Site or Web or Modern Site. A modern site is actually a Site Collection. Sigh.)

Let’s say either your users have set the Document library settings in the UI or you’ve run some PowerShell (like the example above) to change the setting in specific Document Libraries. Well, to clean things up, you need to toggle the DefaultItemOpenUseListSetting property back to False if you want ALL documents in ALL Document Libraries in the Site Collection to open in the client application. Otherwise, you might have a mix of:

  • Open in the client application 
  • Open in the browser 

This is the PowerShell to do this:

$siteURL = "https://mytenant.sharepoint.com/sites/siteName/" 
Connect-PnPOnline -Url $siteURL 

# Open documents on the client
$web = Get-SPWeb -site $siteURL
foreach ($spList in $web.Lists | Where-Object { $_.Title -eq 'Documents' } ) {
    $spList.DefaultItemOpenUseListSetting = [System.Booolean]::False
    $spList.Update()
}

Even better, what if you wanted to change the behavior across your farm or tenant? Well, you can enable the Open Documents in Client Applications by Default (aka OpenInClient) feature on all your Site Collections, should you so choose.

# Get all site collections of the web app and iterate through
$siteCollections = Get-SPSite -WebApplication $WebAppURL -Limit ALL

Foreach ($siteCollection in $siteCollections ) { 

    Write-Host "Working on site: $($siteCollection.Url)"

    # Connect to the Site Collection
    $site = Connect-PnPOnline -Url $siteCollection.Url  -ReturnConnection

    # Get the feature properties so we don't need to know the GUID
    $feature = Get-SPFeature | Where-Object { $_.DisplayName -eq 'OpenInClient' -and $_.CompatibilityLevel -eq 15 }

    # Enable the feature
    Enable-SPFeature -Identity $feature.Id -Url $site.Url;

}

If this all seems confusing, it is. If you’re an end user or site owner, the UI settings options probably make pretty good sense. If you’re a SharePoint admin, the PowerShell probably makes pretty good sense. (There are MANY articles out there about this from the admin perspective.)

But the tricky part is where those two camps need to communicate about all this. If you don’t ask for the right thing, you might not get the thing you want. You probably want to do one of the following:

  • Open documents in a specific Document Library in the client applications
  • Open the documents in a specific site in the client applications
  • Open the documents in the entire farm or tenant in the client applications

Time will go by and you may want to REVERT those decisions and:

  • Open documents in a specific Document Library in the browser
  • Open the documents in a specific site in the browser
  • Open the documents in the entire farm or tenant in the browser

The key here is to understand how the settings and the feature work together in order to be successful. If you’ve made choices out of concert with each other, you may end up with a mess of inconsistent behavior on your hands.

As with so many things, effective communications – from both sides! – are important to reach the mutual goals.

Similar Posts

12 Comments

  1. I believe that setting only affects Internet Explorer today; Edge and Chrome ignore it and still open in the browser (Office Online). Users can right-click to use the option to open in the local app in all browsers.

    1. The reason I wrote the post was working through it with Chrome for a client, but it was SharePoint 2019 in this instance. We didn’t even test IE – the client doesn’t use it. (And nor should you!)

      M.

  2. Nope. I selected: Library Settings/Advanced settings/Open in the client application and it simply does not work. Tested in IE, Edge, and Chrome. In all 3 cases it opens the document in the browser, not in the native app. (PPT in my case)

  3. Hi,
    I’m also interested to know how to set to open in browser in Online.
    DefaultItemOpenUseListSetting is readonly and DefaultItemOpen is missing

  4. My customer, a Site Owner, wants all Office files within the site to open in the desktop app, not the browser. The site and collection are both set to open files in client apps. The files open in client apps when accessing them from the library, but the files are presented on a Web page as a library Web part, they still open in the browser (Edge 88.0.705.53). Same thing when accessing files via Fast and Modern Search results. Tyranny of the browser. What up? Solutions, anyone? Thx!

  5. We are looking to create new documents (New > Document) in client application (such as word, excel etc). Currently, when we create a new document it always creates it in browser (Word Online, Excel Online). I have changed the setting so that all the documents open in native application (Open Documents in Client Applications by Default activated) but creation of new documents still happen in browser. Would you happen to know how to change it so that new documents can be created in native applications instead?

  6. Is there a way to open documents from search results? This setting does not affect documents which appear in search results.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.