SharePoint Online: PowerShell to Disable Modern Experience
Requirement: Disable modern experience in SharePoint Online.
How to disable New User Experience in a List and Switch back to Classic View?
Definitely, the modern experience in SharePoint Online lists and libraries is faster, mobile-friendly, and easier to use. It brings new functionalities and components, such as: Quick edit metadata with an information panel, Pin-Filter, Copy-Move, Custom Views, Column Formatting, Folder upload, etc. However, some features can only be used in the classic experience. So, you may need to disable the modern experience in SharePoint Online at times. How do I change SharePoint Online to the classic view?
To disable the modern experience in SharePoint Online, navigate to the list or library and use the link “Return to Classic SharePoint” in the bottom-left corner.
This sets all lists and libraries to use classic experience.
Disable Modern Experience at List Level:
You can switch between classic and new experiences in SharePoint Online by simply changing the below list settings.
- Go to List or Library settings >> Click on “Advanced Settings”
- Scroll down to the bottom, and from the “List experience” section, select the “Classic Experience” option and click OK.
- This changes the list UI back to the classic experience in SharePoint Online:
PowerShell to Disable Modern Experience in a List
Let me show you how to disable the modern experience in SharePoint Online using PowerShell:
#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"
#Variables for Processing
$SiteUrl = "https://crescent.sharepoint.com/sites/marketing/2018"
$ListName= "Documents"
#Get Credentials to connect
$Cred = Get-Credential
Try {
#Set up the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
#PowerShell to disable modern experience in SharePoint Online
$List = $Ctx.web.Lists.GetByTitle($ListName)
$List.ListExperienceOptions = "ClassicExperience"
$List.Update()
$Ctx.ExecuteQuery()
Write-host "Modern Experience has been Disabled for the list!" -ForegroundColor Green
}
catch {
write-host "Error: $($_.Exception.Message)" -Foregroundcolor Red
}
How to disable the New experience at the Site Collection Level?
How do I change a modern site to a classic site in SharePoint online? To turn off the modern experience at the site collection, follow these steps:
- Click on Settings Gear >> Site Information >> View All Site Settings >> Site Collection Features.
- Scroll down and find “SharePoint Lists and Libraries experience” and activate.
This will turn off modern experience from all lists and libraries at the site collection level, provided the list experience is set to “Default experience for the site.”
Disable Modern Experience at Site Collection using PnP PowerShell
How do I revert to classic SharePoint? Use this PowerShell script to activate the classic view:
#Config Variables
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"
#Connect PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#Disable Modern Experience at Site Collection level by activating Classic Exp Feature
Enable-PnPFeature -Identity "E3540C7D-6BEA-403C-A224-1A12EAFEE4C4" -Scope Site
Similarly, If you need to disable the new experience at the web level, use:
Enable-PnPFeature -Identity "52E14B6F-B1BB-4969-B89B-C4FAA56745EF" -Scope Web
If you need to enable or disable modern experience for a site or site collection using PowerShell CSOM script, use: SharePoint Online: Set List UI to Modern Experience or Classic Experience using PowerShell
Conclusion
SharePoint Online modern experience provides a more intuitive and user-friendly interface. However, in some cases, organizations may need to disable the modern experience in SharePoint Online, either due to compatibility issues or to maintain consistency with previous versions of SharePoint. Disabling the modern experience in SharePoint Online can be achieved through the use of PowerShell. By following the steps outlined in this article, you can successfully disable the modern experience for a specific site collection or for your entire SharePoint Online environment.
Thanks Pal. Your blog is quite precise and informative.