Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.
$session = Get-SPTaxonomySession -Site $sitename
$termStore = $session.TermStores[“Managed Metadata Application”]
$group = $termstore.CreateGroup(“My New Group”)
$group.Description = "My Term Group"
$termStore.CommitAll()
$termSet = $group.CreateTermSet(“My TermSet”,1033)
$termSet.Description = “My TermSet”
$termSet.IsAvailableForTagging = $true
$termSet.IsOpenForTermCreation = $true
$termStore.CommitAll()

Here like $termSet.IsAvailableForTagging I want to enable "Use this Term Set for Site Navigation" using powershell.

Thanks in advance

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Finally I achieved it with following code.

 $navigationSet = $group.CreateTermSet($termsetName)
 $navigationSet.SetCustomProperty("_Sys_Nav_IsNavigationTermSet", "True")
 $navigationSet.SetCustomProperty("_Sys_Nav_AttachedWeb_SiteId", $site.ID.ToString())
 $navigationSet.SetCustomProperty("_Sys_Nav_AttachedWeb_WebId", $site.RootWeb.ID.ToString())    
 $navigationSet.SetCustomProperty("_Sys_Nav_AttachedWeb_OriginalUrl", $site.RootWeb.Url )
share|improve this answer
add comment

This code should help you:

     // Obtain navigation term set
     NavigationTermSet navigationTermSet = NavigationTermSet.GetAsResolvedByWeb(termSet, web, "GlobalNavigationTaxonomyProvider");
     // Specify that this term set can be used for site navigation
     navigationTermSet.IsNavigationTermSet = true;
     // specify target page for all terms in this term set 
     navigationTermSet.TargetUrlForChildTerms.Value = "~site/Pages/Topics/Topic.aspx";
share|improve this answer
1  
How to obtain the same in powershell? –  Anuja Feb 5 '13 at 6:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.