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
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();
yes you can do this.
I had also almost the same requirement. I did this task by the following way
- Create a webpart for reading excel file and create menu
- Open the masterpage using sharepoint designer and comment the lines which render the top navigation and place the new webpart there
- Inherit this masterpage in its subsite.
If you want more help, pls ask me, I can help you
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.
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.
精彩评论