How to Switch to Classic Document Library Experience in SharePoint online or Office 365 using Powershell.

Hello SharePointers,

Below is the Sharepoint code to switch back to  Classic Document Library  Experience from Modern library experience using Powershell.

Add-Type -Path “C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll”
Add-Type -Path “C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.Runtime.dll”
$MyCredentials = Get-Credential
Connect-SPOService -Url https://mylab-admin.sharepoint.com -credential $MyCredentials
$webUrl = ‘https://mylab-sharepoint.com/sites/’
[Microsoft.SharePoint.Client.ClientContext]$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
$clientContext.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($MyCredentials.UserName,$MyCredentials.Password)
$site = $clientContext.Site;
$clientContext.load($site);
$sitefeatureguid = new-object System.Guid “E3540C7D-6BEA-403C-A224-1A12EAFEE4C4”
$site.Features.Add($sitefeatureguid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None);
$clientContext.ExecuteQuery();

Happy SharePointing Folks!Hope it helps!!

Leave a Reply

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