PowerShell Script – CSOM – Enable Disable Modern UI and Classic UI in SharePoint Office 365

Sathish Nadarajan
 
Solution Architect
December 5, 2017
 
Rate this article
 
Views
4837

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.

clip_image002

To enable the Classic View, we have a link on the left bottom.

clip_image003

 

 

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.

Author Info

Sathish Nadarajan
 
Solution Architect
 
Rate this article
 
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 15+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business ...read more
 

Leave a comment