SharePoint navigation development
2. Let's take a general look at "navigation"
(1) Global Navigation: navigation of the entire website set. (if the company's website has many sub-websites, global navigation will be used.) paste the following code:
Using Microsoft. sharepoint. publishing. navigation; portalsitemapprovider PSM = new portalsitemapprovider (); PSM. navigationtype = portalnavigationtype. global; foreach (sitemapnode node in SMS. rootnode. childnodes) {// This is recursion. recursively returning all the nodes and navigation}
(2) current navigation: navigation of the current website; (there are many modules under the current website, and the current navigation will be used); paste the main code
Using Microsoft. sharepoint. publishing. navigation; portalsitemapprovider PSM = new portalsitemapprovider (); PSM. navigationtype = portalnavigationtype. current; foreach (sitemapnode node in SMS. currentnode. childnodes) {// This is recursion. recursively returning all the nodes and navigation}
OK. That's simple. Just a few code lines will be displayed!