<分区>
如何在 Sharepoint 2010 中使用 CustomAction 添加功能区项目
标签 sharepoint
<分区>
如何在 Sharepoint 2010 中使用 CustomAction 添加功能区项目
最佳答案
以下是在 SharePoint 2010 中使用 CustomAction 将名为“测试操作 1”的功能区项目(按钮)添加到 TemplateType = 10003 的列表的步骤
1.添加一个新元素并添加以下代码。请注意,有两个 CustomAction。一个用于添加功能区按钮,另一个用于添加 javascript 文件。
RegistrationId 与 ListTemplateType 相同。
有关默认服务器功能区自定义位置的列表,请参阅 this article .
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction ShowInLists="TRUE" Id="TestAction1" RegistrationType="List" RegistrationId="10003" Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children">
<Button Id="Ribbon.ListItem.Actions.TestAction1" Alt="Test Action 1" Sequence="10" Image32by32="/_layouts/images/ACTIONSEDITPAGE.PNG" Command="Test_Action1" LabelText="Test Action 1" TemplateAlias="o2"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="Test_Action1" CommandAction="javascript:TestAction1();" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction Id="Test.Ribbon.TestScript" Location="ScriptLink" ScriptSrc="~/_layouts/SPTest/TestJScript1.js" />
</Elements>
2.映射Layouts文件夹并添加TestJScript1.js文件。
function TestAction1() {
alert("This the test action 1");
}
查看示例项目结构
关于sharepoint - 如何在 Sharepoint 2010 中使用 CustomAction 添加功能区项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13011196/
相关文章:
javascript - SharePoint Web 部件上的 jQuery.hover 不起作用
asp.net - Sharepoint 2010 API 上传带有元数据的文件从 ASP.NET Web 应用程序创建新版本
javascript - sharepoint Javascript 集合尚未初始化
c# - 在 Word 文档的开头插入文本 - openXML
sharepoint - 当 Word Doc 位于服务器上时,如何从 Excel VBA 更改 Word Doc 中的文本?
sharepoint - 如何安装 SharePoint 版本?
sharepoint - 在 SPListItem 中设置作者字段不会持续存在