如何将代码挂接到Sharepoint:动态更新快速启动 [英] How to Hook Code to Sharepoint : Update Quick Launch Dynamically

查看:73
本文介绍了如何将代码挂接到Sharepoint:动态更新快速启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网上找到了一些用于快速更新启动的代码,例如允许添加的代码,并且可能是更新快速启动链接


I found some code on net for Update quick launch like which allow to add and might be update quick launch link


SPSite siteCollection = SPControl.GetContextSite(Context);
SPWeb site = siteCollection.AllWebs["MySitecoll"];
SPWeb subSite = site.Webs["MyWeb"];
SPNavigationNodeCollection nodes = subSite.Navigation.QuickLaunch;
SPNavigationNode navNode = new SPNavigationNode("New Link", "/Pages/mylib/Allitems.aspx", false);
nodes.AddAsFirst(navNode);



但是我的问题是如何将代码连接到SharePoint网站,以便每次用户登录到网站时都可以执行该代码.



But my question is how to hook the code to a SharePoint site such that it gets executed every time on user login to site. Can you please provide any inputs on that?

推荐答案

有时仅使用代码而不理解它有时会很危险.此处的物品未正确处置或正确使用.

如果您需要为每个用户修改QuickLaunch,则创建自己的导航控件将更加容易,并且可能更可靠,更强大.现有的QuickLaunch菜单是使用SiteMapDataSource的ASP.NET菜单控件.非常容易获得自己的数据,使用相同的数据源并根据需要为每个用户添加项目.
It is sometimes dangerous to just use code without understanding it. The objects here are not being properly disposed of nor used correctly.

If you need the QuickLaunch to be modified for each user it would be easier, and perhaps more reliable and robust to create your own navigation control. The existing QuickLaunch menu is an ASP.NET menu control that uses a SiteMapDataSource. Very easy to derive your own, use the same data source and add the items as necessary for each user.


这篇关于如何将代码挂接到Sharepoint:动态更新快速启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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