1

I have used the SharePoint structural navigation.

I need to check the navigation node is exist or not, so I need to get all the navigation nodes using PowerShell.

How can this be done?

1 Answer 1

3

User TopnavigationBar property from $web.Navigation. It will load all nodes from global navigation.

Use below code:

 $SPWeb=Get-SPWeb  "Url"
 $topnavigation = $SPWeb.Navigation.TopNavigationBar 
 foreach($node in $topnavigation) 
 {
     $node.Title
     //Your logic
 }
3
  • Yes, it retrieves all the global navigation items.but i have disabled the 'Show pages' check box.so i dont need the pages navigation node. how to i do this?please suggest idea.
    – PGP
    Commented Feb 8, 2017 at 7:59
  • 1
    $node.Properties.NodeType -ne [Microsoft.SharePoint.Publishing.NodeTypes]::Page , add this condition in foreach. Commented Feb 8, 2017 at 8:32
  • 1
    $subnodeGroup = $node.Children foreach($subnode in $subnodeGroup) { $subnode.Title //your rest logic } Commented Feb 8, 2017 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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