Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. using (SPWeb web = site.OpenWeb()) //Can user SPContext.Current.Web
  2. {
  3. SPNavigationNodeCollection quickLaunchNodes = web.Navigation.QuickLaunch;
  4.  
  5. //Parent
  6. foreach (SPNavigationNode node in quickLaunchNodes)
  7. {
  8. string strParentTitle = node.Title;
  9. string strParentURL = node.Url.ToString();
  10. Console.WriteLine("Parent : " + strParentTitle + " : " + strParentURL);
  11. //Children
  12. SPNavigationNodeCollection children = node.Children;
  13. foreach (SPNavigationNode child in children)
  14. {
  15. string strTitle = child.Title;
  16. string strURL = child.Url.ToString();
  17. Console.WriteLine("Child : " + strTitle + " : " + strURL);
  18. }
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement