Forum Discussion
Provisioning Metadata Navigation using CSOM
This should be possible according to multiple pages found online, like this https://srinivasananand.wordpress.com/2015/10/29/activating-document-lib-tree-navigation-using-csom/
However, I'm having the problem that the new settings do not automatically become visible in the List GUI. I first have to press Apply/OK in the metadata navigation settings (that shows my changes correctly) of the list before I can see the keyfilters I've added in the list GUI.
Here's my script:
$list = Get-PnPList -Web $web -Identity $aListName -ErrorAction SilentlyContinue;
if ($list)
{
$prop = Get-PnPProperty -ClientObject $list -Property 'RootFolder';
$aRootFolder = $list.RootFolder;
$prop2 = Get-PnPProperty -ClientObject $aRootFolder -Property 'Properties';
$aRootFolder.Properties["client_MOSS_MetadataNavigationSettings"] = "bunch of correct XML";
$aRootFolder.Update();
$list.Update();
$web.Context.ExecuteQuery();
}