Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function enableCatalog($arrayOfLists)
- {
- foreach($list in $arrayOfLists)
- {
- write-host "Enabling catalog on list " $list -foregroundcolor Yellow
- $list.IndexedRootFolderPropertyKeys.Add("PublishingCatalogSettings")
- $list.IndexedRootFolderPropertyKeys.Add("IsPublishingCatalog")
- #Break permission inheritance
- $list.BreakRoleInheritance($true,$true)
- #Enable anonymous to the catalog
- $list.AnonymousPermMask = 8192 # 0 to disable anonymous
- $rootFolder = $list.RootFolder
- $rootFolder.Properties.Add("IsPublishingCatalog", "True") #Activate catalog
- $rootFolder.Update()
- $list.Update()
- write-host "Catalog successfully enabled on " $list -foregroundcolor Green
- }
- }
- $lists = <an array of list objects>
- enableCatalog $lists
- $web.Dispose()
- $site.Dispose()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement