使用javascript将网址属性添加到导航节点quicklaunch. [英] Add url proprties to navigation node quicklaunch using javascript.
问题描述
您好专家
我需要添加导航链接以使用具有querystring的url来快速启动.我尝试使用浏览器设置带有查询字符串的url,但是它不接受.我发现使用服务器端代码实现相同目的的代码,但我无权访问服务器. 所以我想使用javascript api编写相同的代码
I have requirement to add navigation link to quicklaunch with url having querystring. I tried using browser to set url with query string however it wont accept. i have found code using server side code to achieve the same but i dont have access to server. so i want to write the same code using javascript api
using (var site = new SPSite("http://mySite"))
{
using (var web = site.OpenWeb())
{
var newNode = new SPNavigationNode("My Link", "pages/myPage.aspx");
newNode = web.Navigation.QuickLaunch.AddAsFirst(newNode);
newNode.Properties.Add("NodeType", "AuthoredLinkPlain");
newNode.Properties.Add("UrlQueryString", "key=abc");
newNode.Update();
}
}
推荐答案
请参考以下文章尝试使用REST API,以添加指向快速启动的链接.
Please refer the below article to try with REST API to add a link to quick launch.
https://rmanimaran.wordpress.com/2014/11/12/sharepoint-2013-working-on-navigation-using-rest-api/
https://rmanimaran.wordpress.com/2014/11/12/sharepoint-2013-working-on-navigation-using-rest-api/
最好的问候,
拉梅什
Best Regards,
Ramesh
这篇关于使用javascript将网址属性添加到导航节点quicklaunch.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!