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));
clientContext.ExecuteQuery();
foreach (var list in lists)
{
if (list.ListExperienceOptions != ListExperience.ClassicExperience)
{
list.ListExperienceOptions = ListExperience.ClassicExperience;
// list.ListExperienceOptions = ListExperience.NewExperience;
// list.ListExperienceOptions = ListExperience.Auto;
list.Update();
}
}
clientContext.ExecuteQuery();
The simple property ListExperienceOptions provide the option to change the default options of a list.
Happy Coding,
Sathish Nadarajan.
Leave a comment