我希望我的自定义操作菜单应用于特定列表;目前它使用以下 XML 指定,它被应用于所有列表!
更具体地说;我什至希望将此自定义操作应用于特定列表的特定 View ...
<CustomAction
Id="MyCustomActionId"
Title="My Custom Action"
Description="My Custom Action Description"
RequireSiteAdministrator="FALSE"
RegistrationType="List"
GroupId="ActionsMenu"
Sequence="1000"
Location="Microsoft.SharePoint.StandardMenu" >
<UrlAction Url="{SiteUrl}/_layouts/MySharepointArtifacts/MyCustomAction.aspx?ListId={ListId}"/>
</CustomAction>
我怎样才能做到这一点?
最佳答案
创建一个内容类型(基于您要在其上创建 ECB 菜单的项目)并将该内容类型添加到您的列表中。创建一个 customAction 并将其注册到内容类型。 ECB 菜单只会在您添加内容类型的列表中显示给定内容类型的项目。
这是基于内置文档内容类型的内容类型:
<?xml version="1.0" encoding="utf-8"?>
<Elements Id="f55bc095-86f5-4c0a-961e-0e8f8e6c50ed" xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x0101002936a05e70da4cf2a6846c669da7fdb6"
Name="CTName"
Group="CT group Name"
Description="CT description"
Version="0">
<FieldRefs>...
为内容类型创建自定义操作(引用内容类型 ID):
<CustomAction
Id="MyCustomActionId"
Title="My Custom Action"
Description="My Custom Action Description"
RequireSiteAdministrator="FALSE"
RegistrationType="ContentType"
RegistrationId="0x0101002936a05e70da4cf2a6846c669da7fdb6"
GroupId="ActionsMenu"
Sequence="1000"
Location="EditControlBlock" >
<UrlAction Url="{SiteUrl}/_layouts/MySharepointArtifacts/MyCustomAction.aspx?ListId={ListId}"/>
</CustomAction>
关于sharepoint - 特定 Sharepoint 列表的自定义操作菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1999642/