2. }
catch
{
$FailedItem = $_.Exception.ItemName
$ErrorMessage = $_.Exception.Message
Write-Output $FailedItem $ErrorMessage
Break
}
}
Process
{
$sourceTermMarcos = $navigationTermSetMarcos.GetAllTerms()
##$rootNavigationTerm = $navigationTermSet.GetAllTerms() | ?
{ $_.Name -eq $rootTermName.Trim() }
$rootNavigationTermMarcos = $navigationTermSetMarcos.GetAllTerms() |
?{ $_.Name -eq $rootTermName.Trim() }
Write-Output "Added Catalog
Connection:"$rootNavigationTermMarcos.Name
if ($rootNavigationTermMarcos)
{
$catalogSettings =
[Microsoft.SharePoint.Publishing.PublishingCatalogUtility]::GetPublishingCatalog
($site, $catalogUrl)
if (-not [string]::
IsNullOrEmpty($catalogSettings.CatalogName))
{
$catalogSettings.ConnectedWebServerRelativeUrl =
"/publishing"
$catalogSettings.RewriteCatalogItemUrls = $true #rewrite
the urls of the Product Items to match our term driven navigation if set to
true, if this isnt set to true we will get the full url to the item in the
content site where the Product Item is located
$catalogSettings.ConnectedWebId = $site.RootWeb.ID # id
of the web site where our Site Navigation Group resides
$catalogSettings.CatalogItemUrlRewriteTemplate = "/
[Title]" # how we want the end of the url to be displayed, in this case it is
the title of the navigation term
$catalogSettings.CatalogTaxonomyManagedProperty =
$catalogTaxonomyManagedProperty # name of the managedproperty associated with
our catalog.
$catalogSettings.CatalogNavigationTerm =
$rootNavigationTermMarcos.Id # id of our root navigation term
#$catalogSettings.IsReusedWithPinning=$True
try
{
#$ccmanager.UpdateCatalogConnection($catalogSettings)
#$ccmanager.update()
$ccmanager.AddCatalogConnection($catalogSettings)
$ccmanager.update()
Write-Output "Added Catalog
Connection:"$catalogSettings.CatalogName
Write-Output "Added Catalog
Connection:"$catalogSettings.CatalogNavigationTerm
}
catch
{