Enable/Disable Modern UX in SharePoint Online with PowerShell & CSOM

Microsoft has announced the rollout of several new enhancements to SharePoint Online team sites in Office 365. These  enhancements are the Modern UX for Team Site publishing pages/new web parts and OneDrive for Business sites in SharePoint Online in Office 365. Modern lists and support for Microsoft Flow and PowerApps, Modern Document libraries, Site Contents Page of Team sites already have the modern UX. A default out-of-the-box setting is available in Office 365, SharePoint admin center to switch the Design mode to the New Modern UX or to stay Classic.

Note: We need to note that `classic’ experience is not deprecated and both `classic` and `modern` will coexist.

In addition to these, we need to control the settings to implement the new design for multiple sites in an Office 365 environment. There are PowerShell commands available that you can use to add or remove hidden features related to the new Modern UI, at Web or Site Collection level using the popular CSOM.

We need to understand the reasons to switch from Modern UX to Classic at various scope levels.

  1. When you have customizations that affect document library pages.
  2. Whenever the pages represent business-critical functionalities.

We can determine which sites and site collections have to be changed to Classic using the following PowerShell script with a CSOM.

Please follow the given steps using SharePoint Online Management Shell to enable or disable Modern UX for SharePoint Online Team sites using the CSOM model.

Step 1 – Add the assemblies to Run the following in SharePoint Online Management Shell

Add-Type -Path “C:Program FilesSharePoint Online Management ShellMicrosoft.Online.SharePoint.PowerShellMicrosoft.SharePoint.Client.dll”

Add-Type -Path “C:Program FilesSharePoint Online Management ShellMicrosoft.Online.SharePoint.PowerShellMicrosoft.SharePoint.Client.Runtime.dll”

SharePoint Online Management

With the latest SharePoint Online Management Shell installed the above assemblies should be in your “C:Program FilesSharePoint Online Management Shell” folder as shown below.

SharePoint Online Management Shell

Steps 2 – We need to load the variables for your Site Collection and Web as required. Provide a global administrator credentials in the below code snippet.

Global Administrator

Step 3 – Change the Classic experience for sites/site collections.

To change the Classic experience for document libraries on a site collection/Site Contents Page, we need to REMOVE the feature ‘E3540C7D-6BEA-403C-A224-1A12EAFEE4C4’ from Site Collection feature definition.

SharePoint Consulting Services

To switch your Site Collection to New UX, run the following code snippet:

Site Collection UXAdministrator SharePoint Management Shell

To switch your Site Collection to Classic mode, run the following code snippet:

Client Collection

Step 4 – Change the Classic experience for Web/Subsites in a site collections.
To change the Classic experience for document libraries on a Web/Subsite, we need to REMOVE the feature ’52E14B6F-B1BB-4969-B89B-C4FAA56745EF’ from Website’s feature definition.

code snippet

To switch your Web to New UX mode, run the following code snippet:

Web to New UX mode

To switch your Web to Classic mode, run the following code snippet:
Modern UX

SharePoint Online site

We can login to the site/site collection and test the Site Contents page on your SharePoint Online site in Office 365.

With the Modern UX in SharePoint Online in Office 365

Modern UX in SharePoint Online

Below picture represents the Classic UX in SharePoint Online in Office 365

SharePoint Online in Office 365


  • Guruswamy Jetti

    Guruswamy Jetti works as Module Lead with Trigent Software. He comes with over 9+ years of software development experience in Microsoft technologies, web development using SharePoint (WSS 3.0 to SharePoint Online) and Cloud based solutions such as Microsoft Azure and Office 365. He also has strong experience in integrating Microsoft CRM with SharePoint and SSRS reports.