SharePoint【学习笔记】-- SharePoint的导航开发

   sharepoint的导航开发

SharePoint【学习笔记】-- SharePoint的导航开发

SharePoint【学习笔记】-- SharePoint的导航开发

2、来大体讲一下“导航”

(1)全局导航 : 整个网站集的导航;(如果公司的网站有很多子网站,这时便会用到全局导航啦);贴一下主要代码:

复制代码
using Microsoft.SharePoint.Publishing.Navigation; PortalSiteMapProvider psm = new PortalSiteMapProvider(); psm.NavigationType = PortalNavigationType.Global; foreach (SiteMapNode node in psm.RootNode.ChildNodes) { //这里面就是递归啦,把所有的node都递归出来,导航就出来啦

}
复制代码

(2)当前导航 : 当前网站的导航;(当前网站下有很多模块,这时便会用到当前导航);贴一下主要代码

复制代码
using Microsoft.SharePoint.Publishing.Navigation; PortalSiteMapProvider psm = new PortalSiteMapProvider(); psm.NavigationType = PortalNavigationType.Current; foreach (SiteMapNode node in psm.CurrentNode.ChildNodes) { //这里面就是递归啦,把所有的node都递归出来,导航就出来啦

}
复制代码

  OK,就这么简单,几句代码导航就出来啦!

你可能感兴趣的:(SharePoint)