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

Hello SharePointers,

Below is the piece of powershell code to switch to modern SharePoint Library experience from classic in SharePoint Online.

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”
$Credentials = 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($Credentials.UserName,$MyCredentials.Password)
$site = $clientContext.Site;
$clientContext.load($site);
$featureguid = new-object System.Guid “E3540C7D-6BEA-403C-A224-1A12EAFEE4C4”
$site.Features.Remove($featureguid, $true);
$clientContext.ExecuteQuery();

Hope it helps !! Happy SharePointing guys!!

Leave a Reply

Your email address will not be published.