Configure Key Filters in SharePoint 2010 using powershell

Here i will be adding the choice column to the Key Filters.

$siteURL="
http://serverName:1111/"
$site=Get-SPSite $siteURL
$web=$site.RootWeb
$list=$web.Lists.TryGetList("cl")
$field=$list.Fields["Country"]
$listNavSettings=[Microsoft.Office.DocumentManagement.MetadataNavigation.MetadataNavigationSettings]::GetMetadataNavigationSettings($list)
$mdnKeyFilter=New-Object Microsoft.Office.DocumentManagement.MetadataNavigation.MetadataNavigationKeyFilter($field)
$listNavSettings.AddConfiguredKeyFilter($mdnKeyFilter)
[Microsoft.Office.DocumentManagement.MetadataNavigation.MetadataNavigationSettings]::SetMetadataNavigationSettings($list, $listNavSettings, $true)
Ebook Download
View all
Learn
View all