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 information pane, 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 modern experience in SharePoint Online at times.

To disable modern experience in SharePoint Online, Navigate to the list or library and then 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 "List experience" section, Select "Classic Experience" option and Click OK.sharepoint online powershell disable modern experience
  • This changes the list UI back to classic experience in SharePoint Online:
    SharePoint Online Set List to Modern Experience
Update: The tenant level settings for lists and library experience in SharePoint Online Admin Center is no longer possible!

PowerShell to Disable Modern Experience in a List
#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 about disabling new experience at site collection level?

Disable Modern Experience at Site Collection using PnP PowerShell
#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 new experience at 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
SharePoint Online: PowerShell to Disable Modern Experience SharePoint Online: PowerShell to Disable Modern Experience Reviewed by Salaudeen Rajack on August 12, 2018 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.