Forum Discussion

Norman Mann's avatar
Norman Mann
Copper Contributor
Oct 22, 2016

Provisioning Metadata Navigation using CSOM

Is it possible to enable Metadata Navigation for a list or libray using CSOM and preferably using PnP PowerShell or the PnP Provisioning framework ?

6 Replies

  • Jurgen Wiersema's avatar
    Jurgen Wiersema
    Copper Contributor

    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();
    }

  • I thought it was not possible at this time. But you could always write a extention to do this.

  • Dean_Gross's avatar
    Dean_Gross
    Silver Contributor

    It does not appear to be currently possible with the pnp powershell cmdlets because a parameter for that setting is not availabe in the set-spolist cmdlet. Erwin van Hunen should have some additional insight.

Resources