O365 Sharepoint - Set Default Behaviour Open with Client Apps

Andy Kilgore 21 Reputation points
2021-09-23T21:42:05.2+00:00

I know on a per-site basis we can do the following:
At the document library level, we could go to Library settings>Advanced settings>Open in the client application:

134707-image.png

Then go to Site information>View all site settings>Site Collection features> activate the feature as shown below:
134769-image.png

But how can I do this:
A) Globally to all existing sites/libraries
B) As the default for newly created sites/libraries

I tried with

Connect-PnPOnline $SiteURL  
$FeatureID = "8a4b8de2-6fd8-41e9-923c-c7c3c00f8295"  
Enable-PnPFeature -Identity $FeatureID -Scope Site  

Although this completes without error the it only updates the later section for the collection and also it doesn't help me default this decision for new objects.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,740 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yi Lu_MSFT 17,461 Reputation points
    2021-09-24T09:27:13.037+00:00

    Hi @Andy Kilgore
    To globally activate “Open Documents in Client Applications by Default” feature on all existing sites of the tenant, you could can use the following code.

    #Parameters  
    $TenantAdminURL = "https://Crescent-Admin.SharePoint.com"  
    $FeatureId = "8a4b8de2-6fd8-41e9-923c-c7c3c00f8295" #"Following Content" Web Scoped Feature  
        
    #Function to Activate a Web Feature in SharePoint Online  
    Function Activate-PnPWebFeature  
    {  
        [cmdletbinding()]  
        Param(  
            [parameter(Mandatory = $true, ValueFromPipeline = $True)] $Web,  
            [parameter(Mandatory = $true, ValueFromPipeline = $False)] $FeatureId  
        )  
        
        Try {  
            Write-host -f Yellow "Trying to Activate Feature on:"$web.Url  
            #Get the Feature to activate  
            $Feature = Get-PnPFeature -Scope Web -Identity $FeatureId -Web $Web -Connection $SiteConn -ErrorAction Stop  
        
            #Check if the Feature is Activate  
            If($Feature.DefinitionId -eq $null)  
            {  
                #Activate the feature  
                Enable-PnPFeature -Scope Web -Identity $FeatureId -Force -Web $Web -Connection $SiteConn -ErrorAction Stop  
                Write-host -f Green "`tFeature Activated Successfully!"  
            }  
            Else  
            {  
                Write-host -f Cyan "`tFeature is already active!"  
            }  
        }  
        Catch {  
            write-host "`tError Activating Feature: $($_.Exception.Message)" -foregroundcolor Red  
        }  
    }  
        
    #Connect to Admin Center  
    $Cred = Get-Credential  
    Connect-PnPOnline -Url $TenantAdminURL -Credentials $Cred  
        
    #Get All Site collections - Exclude: Seach Center, Mysite Host, App Catalog, Content Type Hub, eDiscovery and Bot Sites  
    $SitesCollections = Get-PnPTenantSite | Where -Property Template -NotIn ("SRCHCEN#0", "SPSMSITEHOST#0", "APPCATALOG#0", "POINTPUBLISHINGHUB#0", "EDISC#0", "STS#-1")  
        
    #Loop through each site collection  
    ForEach($Site in $SitesCollections)  
    {  
        #Connect to site collection  
        $SiteConn = Connect-PnPOnline -Url $Site.Url -Credentials $Cred  
        
        #Call the Function for Web & all Subwebs  
        Get-PnPWeb -Connection $SiteConn | Activate-PnPWebFeature -FeatureId $FeatureId  
        Get-PnPSubWebs -Connection $SiteConn -Recurse | ForEach-Object { Activate-PnPWebFeature $_ -FeatureId $FeatureId}  
        
        Disconnect-PnPOnline -Connection $SiteConn   
    }  
    

    As to the second requirement, currently we could not activate the feature as the default for newly created sites/libraries.


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful