向 sharepoint 2010 顶部导航添加新的导航节点 [英] Adding a new navigation node to sharepoint 2010 Top Navigation

查看:49
本文介绍了向 sharepoint 2010 顶部导航添加新的导航节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向我的 sharepoint 网站的顶部导航栏添加一个新的导航节点,并且我正在使用以下代码:

I am trying to add a new navigation node to Top Navigation bar in my sharepoint website and I am using the following code:

public void AddNavigation(SPWeb web, String url, string module, string key)
{
    var resourceFile = "$Resources:" + module + "," + key;
    UnregisterGlobalNavigationLink(web, url);
    SPNavigationNode node = web.Navigation.GetNodeByUrl(url);
    if (node != null && overrideGlobalNavigationSetting) return node;
    node = new SPNavigationNode(resourceFile, url);
    node = web.Navigation.TopNavigationBar.AddAsLast(node);**//Exception here**
} 

但是我遇到了一个我不知道如何解决的异常:

But I am getting an exception that I don't know how to resolve:

An unexpected error occured while manipulating the navigational structure of this Web.

我该如何解决这个问题?

How can I solve this issue?

推荐答案

如果是外部节点要在节点构造函数中添加另一个参数 isExternal = true ,所以看起来像这样:

If it is an external node you want to add a another parameter isExternal = true to the node constructor, so it looks like this:

node = new SPNavigationNode(resourceFile, url, true);

外部我的意思是它指向网站集之外

And by external I mean it points outside the site collection

这篇关于向 sharepoint 2010 顶部导航添加新的导航节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆