通过代码将自定义链接添加到 SharePoint 列表设置页面

发布于 2024-12-08 08:07:01 字数 481 浏览 0 评论 0原文

我想从代码添加到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

誰認得朕 2024-12-15 08:07:01

您的方向是正确的,但您的位置不正确,您需要一个群组。

请尝试以下操作:

SPUserCustomAction customAction = spCustomList.UserCustomActions.Add();
customAction.Url = "someurlhere";
customAction.Name = "CustomName";
customAction.Location = "Microsoft.SharePoint.ListEdit";
customAction.Group = "GeneralSettings";
customAction.Title = "Custom Settings";
customAction.Update();

有关位置的详细信息,请参阅默认自定义操作位置和 ID。

You are on the right track, but your Location is incorrect and you need a Group.

Try the following:

SPUserCustomAction customAction = spCustomList.UserCustomActions.Add();
customAction.Url = "someurlhere";
customAction.Name = "CustomName";
customAction.Location = "Microsoft.SharePoint.ListEdit";
customAction.Group = "GeneralSettings";
customAction.Title = "Custom Settings";
customAction.Update();

For more information on Locations, see Default Custom Action Locations and IDs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文