Requirement: Open documents in client applications by default in SharePoint Online.
Do SharePoint Online documents open in the browser instead of the client application? By default, documents such as Word, Excel, PowerPoint, etc. open in the browser with Office web apps in SharePoint Online. However, the Office web applications like Word Online don’t give you full functionality as in the client-installed application. So, if you want to change this behavior at the site collection level, You have to activate a feature called “Open Documents in Client Applications by Default”. Here is how to activate the feature:
Activating the feature to open documents in client applications for a single site collection is straightforward. How about activating the feature for all site collections?
When the “Open Documents in Client Applications by Default” feature is activated, Office documents will open in the Office client application by default. E.g., an Excel spreadsheet will open in Microsoft Excel installed on the client’s computer. When this feature is deactivated, an Excel Spreadsheet will open in Office Web Applications within the web browser. Here is the PowerShell to set open documents in client application settings for all site collections in a tenant by activating the feature discussed above.
#Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Function to Activate Feature in SharePoint Online Function Activate-SPOFeature < Param ($SiteURL,$FeatureGuid) Try < #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Credential.Username, $Credential.Password) $Ctx.Credentials = $Credentials $Site=$Ctx.Site #Get the Feature $Feature = $Site.Features.GetById($FeatureGuid) $Ctx.Load($Feature) $Ctx.ExecuteQuery() #Activate the feature if its not activated already Write-Host "Activating Feature $($FeatureStatus.DisplayName) in Site $SiteURL" if($Feature.DefinitionId -eq $null) < #sharepoint online powershell open in client application $Site.Features.Add($FeatureGuid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None) | Out-Null $Ctx.ExecuteQuery() Write-Host "`t Feature Activated!" -ForegroundColor Green >else < Write-host "`t Feature is Already Active on the Site collection!" -ForegroundColor Yellow >> Catch < write-host "Error Activating Feature: $($_.Exception.Message)" -foregroundcolor Red >> #Parameters to Activate Feature $AdminSiteURL = "https://Crescent-admin.sharepoint.com/" $FeatureGuid= [System.Guid] ("8a4b8de2-6fd8-41e9-923c-c7c3c00f8295") #Get Credentials to connect $Credential = Get-Credential #Connect To SharePoint Online Admin Center Connect-SPOService -URL $AdminSiteURL -Credential $Credential #Get All Site collection and loop through ForEach($Site in (Get-SPOSite -Limit ALL))By default, SharePoint Online opens documents in the browser, but if you prefer to work with documents in client applications, you can change the settings to set to open documents in client applications by default. We can enable the feature that sets all documents to open in a client application in a SharePoint Online site with PnP PowerShell as well:
#Parameters $SiteURL = "https://crescent.sharepoint.com/sites/marketing" $FeatureID= "8a4b8de2-6fd8-41e9-923c-c7c3c00f8295" #Open Documents in Client Applications by Default #Connect to SharePoint Online site Connect-PnPOnline $SiteURL -Interactive #Get the Feature $Feature = Get-PnPFeature -Scope Site -Identity $FeatureID #Get the Feature status If($Feature.DefinitionId -eq $null) < #Activate the Feature Enable-PnPFeature -Identity $FeatureID -Scope Site Write-host -f Green "Feature Activated Successfully!" >ElseIn SharePoint Online, you can configure the open document in the browser or client application setting from the document library’s settings.
This overrides the setting applied at the site collection level and opens documents in the client application instead of the browser.
To configure the default open behavior either to the browser or client application, use this PowerShell script:
#Parameters $SiteCollURL = "https://crescent.sharepoint.com/sites/retail" $ListName = "Documents" Try < #Connect to PnP Online Connect-PnPOnline -Url $SiteCollURL -Interactive #Get the Document Library $List = Get-PnPList $ListName -Includes DefaultItemOpenInBrowser #Set the Default Open behaviour for documents to client app $List.DefaultItemOpenInBrowser = $False $List.Update() Invoke-PnPQuery >catchIn conclusion, setting open documents in client applications by default in SharePoint Online can provide several benefits for collaborating on documents and improving productivity, enhanced functionality, Familiarity, etc. By following the steps and best practices outlined in this article, you can easily set open documents in client applications and enjoy the benefits of this powerful feature.