sharepoint的导航开发

时间:2023-12-16 09:02:14

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都递归出来,导航就出来啦
}