How to Set the List View Experience Programmatically into Modern Classic (ListExperienceOptions) in SharePoint Office 365 Programmatically

Sathish Nadarajan
SharePoint MVP
Published On :   26 Aug 2018
Visit Count
Today :  2    Total :   1167

With the introduction of the Modern UI Experience, some of the applications are still required to be opening the Lists default views into Classic Experience. But again, it totally depends up on the client’s requirements. The below code can be used as part of the Provisioning engine to make the views default one.

 var lists = clientContext.Web.Lists;
                 clientContext.Load(lists, col => col.Include(l => l.ListExperienceOptions));
                 foreach (var list in lists)
                     if (list.ListExperienceOptions != ListExperience.ClassicExperience)
                        list.ListExperienceOptions = ListExperience.ClassicExperience;
                         // list.ListExperienceOptions = ListExperience.NewExperience; 
                        // list.ListExperienceOptions = ListExperience.Auto; 

The simple property ListExperienceOptions provide the option to change the default options of a list.

Happy Coding,

Sathish Nadarajan.