Sharepoint 通过编程创建站点导航

发布于 2024-08-25 03:34:31 字数 218 浏览 2 评论 0原文

我在 sharepoint 中有一个要求,我想根据 Excel 文件创建顶部链接导航。意味着站点导航结构(以及父站点下的父站点子站点)在 Excel 文件中提及。我需要阅读该结构并基于修改共享点中的导航。

请任何人告诉我是否可以以这种方式配置导航。如果是,请告诉我如何实现它。

仅供参考:我正在使用 MOSS 2007。

提前感谢

sachin katkar

I have a requirement in sharepoint where I want to Create the top link navigation based on excel file. Means The site navigation structure (along with parent site subsite under parent site) is mention in excel file. I need to read that structure and based on modify the navigation in sharepoint.

Please can any one tell me is it possible to configure navigation in such a way. If yes then please tell me how to achive it.

FYI: I am using MOSS 2007.

thanks in advance

sachin katkar

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

三生池水覆流年 2024-09-01 03:34:31

如果这是一个发布网站,您可以使用类似于以下的代码:

PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(SPContext.Current.Web);
SPNavigationSiteMapNode.CreateSPNavigationNode(title, url, NodeTypes.AuthoredLinkToPage, publishingWeb.GlobalNavigationNodes);
publishingWeb.Update();

If this is a Publishing site, you can use code similar to the following:

PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(SPContext.Current.Web);
SPNavigationSiteMapNode.CreateSPNavigationNode(title, url, NodeTypes.AuthoredLinkToPage, publishingWeb.GlobalNavigationNodes);
publishingWeb.Update();
飞烟轻若梦 2024-09-01 03:34:31

是的,你可以做到这一点。

我也有几乎相同的要求。我通过以下方式完成了此任务

  1. 创建一个用于读取 Excel 文件的 Web 部件并创建菜单
  2. 使用 sharepoint 设计器打开母版页并注释呈现顶部导航的行并将新的 Web 部件放置在那里
  3. 继承此母版页在其子站点中。

如果您需要更多帮助,请问我,我可以帮助您

yes you can do this.

I had also almost the same requirement. I did this task by the following way

  1. Create a webpart for reading excel file and create menu
  2. Open the masterpage using sharepoint designer and comment the lines which render the top navigation and place the new webpart there
  3. Inherit this masterpage in its subsite.

If you want more help, pls ask me, I can help you

浅听莫相离 2024-09-01 03:34:31

哇,这似乎是一个非常糟糕的主意。为什么不使用 SharePoint 列表来填充静态菜单?创建更容易,速度更快,因为它不需要打开 Excel 工作表,并且您可以根据需要从 Excel 工作表复制并粘贴值。

或者,我使用 Excel 工作表收集有关 SharePoint 网站结构的数据,例如哪些网站、模板和子网站等。从该 Excel 工作表中,我生成一个脚本,使用 http://stsadm.blogspot.com
这样,您的菜单将遵循 Excel 工作表的数据,并且不会有笨重的自定义代码。

Wow that seems like a really bad idea. Why not use a SharePoint list to populate a static menu with? Much easier to create, much faster because it does not need to open an Excel sheet, and you can copy and paste values in from an Excel sheet if you like.

Alternatively, I use excel sheets to gather data about the structure of a SharePoint site, e.g. what sites, template and subsites, etc. From that Excel sheet I generate a script to build a site structure using the commands in http://stsadm.blogspot.com
This way, your menu will follow the Excel sheet's data and there will be no clunky custom code.

小女人ら 2024-09-01 03:34:31

有两种方法可以实现此目的 - 在现有 SharePoint 导航结构中添加/删除节点,或者更改菜单控件使用的数据源。

要修改标准导航设置(导航自定义继续像通常开箱即用的那样工作),请使用

web.Navigation.TopNavigationBar

另一个选项上的方法,包括编辑母版页(或适当的委托控件)并更改 AspMenu 和 SiteMapDataSource 元素以使用不同的站点地图提供者。您可以创建自己的实现,也可以使用从 xml 文件读取的开箱即用的实现。如果您选择此选项,用户将无法通过导航设置编辑菜单。

There are two ways you could implement this - either add/remove nodes within the existing SharePoint navigation structure, or change the data source used by the menu control.

To modify the standard navigation settings (navivagation customization continues to work as it usually does out of the box) use the methods on

web.Navigation.TopNavigationBar

The other option involves editing the master page (or appropriate delegate controls) and changing the AspMenu and SiteMapDataSource elements to use a different SiteMapProvider. You can either create your own implementation or use the out of box one that reads from an xml file. If you choose this option the user will not be able to edit the menus through navigation settings.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文