In this article, we can see a handy script to toggle between the Modern UI and Classic UI in SharePoint Office 365.
The default Modern UI of Site will be as below.
To enable the Classic View, we have a link on the left bottom.
The PowerShell Script to toggle between the Modern UI and the Classic UI is as below.
# Add Necessary Client DLLs
Add-Type -Path "C:SATHISHARTICLESClientDLLsMicrosoft.SharePoint.Client.dll"
Add-Type -Path "C:SATHISHARTICLESClientDLLsMicrosoft.SharePoint.Client.Runtime.dll"
#Get the UserName and Password
$UserName = "sathish@*****.onmicrosoft.com"
$password = Read-Host 'Enter Password' -AsSecureString
$Url = "https://**********.sharepoint.com/sites/DeveloperSite/"
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName , $Password)
$context = New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$context.Credentials = $credentials
#Get the Web Scoped Feature
$web = $context.Web
# Feature Title : EnableDefaultListLibrarExperience, Scope : Web
$featureguid = new-object System.Guid "52E14B6F-B1BB-4969-B89B-C4FAA56745EF"
#To Enable/Disable the Modern UI, comment and uncomment the below two lines, either to Add or Remove
#$web.Features.Add($featureguid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
$web.Features.Remove($featureguid, $true)
$context.ExecuteQuery()
#Get the Site Scoped Feature
$Site = $context.Site
# Feature Title : EnableDefaultListLibrarExperience, Scope : Site
$featureguid = new-object System.Guid "E3540C7D-6BEA-403C-A224-1A12EAFEE4C4"
#To Enable/Disable the Modern UI, comment and uncomment the below two lines, either to Add or Remove
#$Site.Features.Add($featureguid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
$Site.Features.Remove($featureguid, $true)
$context.ExecuteQuery()
Happy Coding,
Sathish Nadarajan.
Leave a comment