通过代码将自定义链接添加到 SharePoint 列表设置页面
我想从代码添加到 SharePoint 列表设置页面 (listedit.aspx) 的自定义链接,我搜索了网络和 Stack Overflow,但似乎找不到任何专门执行此操作的示例或文档。
有十几个关于如何从 elements.xml 和部署/激活执行此操作的示例,但我想从 C# 代码执行此操作,如下所示:
SPUserCustomAction customAction = spCustomList.UserCustomActions.Add();
customAction.Url = "someurlhere";
customAction.Name = "CustomName";
customAction.Location = "Microsoft.SharePoint.ListSettings";
customAction.Title = "Custom Settings";
customAction.Update();
spCustomList.Update();
I would like to add a custom link to a SharePoint list settings page (listedit.aspx) from code, I have searched the web and Stack Overflow, and can't seem to find any examples or documentation on doing this specifically.
There are a dozen examples on how to do this from the elements.xml and on deployment/activation, but I would like to do this from C# code, like this:
SPUserCustomAction customAction = spCustomList.UserCustomActions.Add();
customAction.Url = "someurlhere";
customAction.Name = "CustomName";
customAction.Location = "Microsoft.SharePoint.ListSettings";
customAction.Title = "Custom Settings";
customAction.Update();
spCustomList.Update();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的方向是正确的,但您的位置不正确,您需要一个群组。
请尝试以下操作:
有关位置的详细信息,请参阅默认自定义操作位置和 ID。
You are on the right track, but your Location is incorrect and you need a Group.
Try the following:
For more information on Locations, see Default Custom Action Locations and IDs.