Quantcast
Channel: SharePoint Pals - PowerShell
Viewing all articles
Browse latest Browse all 31

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

$
0
0

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:\SATHISH\ARTICLES\ClientDLLs\Microsoft.SharePoint.Client.dll"  Add-Type -Path "C:\SATHISH\ARTICLES\ClientDLLs\Microsoft.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.


Viewing all articles
Browse latest Browse all 31

Trending Articles