0

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?

2

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
 }
  • 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 Feb 8 '17 at 7:59
  • 1
    $node.Properties.NodeType -ne [Microsoft.SharePoint.Publishing.NodeTypes]::Page , add this condition in foreach. – Bhaskar Dhone Feb 8 '17 at 8:32
  • 1
    $subnodeGroup = $node.Children foreach($subnode in $subnodeGroup) { $subnode.Title //your rest logic } – Bhaskar Dhone Feb 8 '17 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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