Configure a list as a catalog with PowerShell to automate cross site publishing configuration in SharePoint 2013.
$siteUrl = "http://<<Server>>/sites/test" $webUrl = "/sites/test/subtest" $site = get-SPSite -Identity $siteUrl $web = Get-SPWeb -Site $site -Identity $webUrl $list = $web.Lists | where { $_.Title -eq 'Pages' }
Adds important Indexed Properties to the List.
$list.IndexedRootFolderPropertyKeys.Add("PublishingCatalogSettings") $list.IndexedRootFolderPropertyKeys.Add("IsPublishingCatalog")
Enables Anonymous Access to the Catalog. (To disable set to 0.)
$list.AnonymousPermMask = 8192
Adds properties to the lists RootFolder to configure the list as catalog.
- IsPublishingCatalog: sets the checkbox in the configure catalog page
- PublishingCatalogSettings: configures the Catalog Item Url Fields and the taxonomy field for the Navigation Hierarchy
- vti_indexedpropertykeys: Those Ids are the fixed Ids of the two Indexed Properties we added to the Lists IndexedRootFolderPropertyKeys.
$rootFolder = $list.RootFolder $rootFolder.Properties.Add("IsPublishingCatalog", "True") $rootFolder.Properties.Add("PublishingCatalogSettings", '{"FurlFields":["Title"],"TaxonomyFieldMap":["<<InternalFieldName>>"]}') $rootFolder.Properties.Add("vti_indexedpropertykeys","UAB1AGIAbABpAHMAaABpAG4AZwBDAGEAdABhAGwAbwBnAFMAZQB0AHQAaQBuAGcAcwA=|SQBzAFAAdQBiAGwAaQBzAGgAaQBuAGcAQwBhAHQAYQBsAG8AZwA=|") $rootFolder.Update() $list.Update()
Now you need to perform a full crawl to let the index catch the previously set indexed properties.