How to add a new "CustomAction" in ECB for a specific list

拷贝customList修改 O(∩_∩)O

 

也可以参考:

http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/40076dc2-8be6-4019-bf1e-54067880e8a8/

 

Instead of creating the feature to associate with all custom lists, you want to create the feature to only work with specific types of lists?  Lists that you create?  Then you'll need to associate the feature with your list type instead of the built-in list types.

 

For this, you'll need to create a feature with (at least) two elements: one to create a new List Template with a unique type, and one to create the custom ECB item that's activated for this unique type.

 

If you copy the CustomList feature to a new feature, then you can start here.

 

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns=" http://schemas.microsoft.com/sharepoint/">
    <ListTemplate
        Name="MyCustomList"
        Type=" ListTemplateType"
        BaseType="0"
        OnQuickLaunch="TRUE"
        SecurityBits="11"
        Sequence="410"
        DisplayName="My Custom List"
        Description="My Custom List"
        Image="/_layouts/images/itgen.gif"/>
</Elements>

 

For the ListTemplateType field , choose a unique identifying integer (different that what's listed below)

Code Snippet

    public enum SPListTemplateType
    {
        InvalidType = -1,
        GenericList = 100,
        DocumentLibrary = 101,
        Survey = 102,
        Links = 103,
        Announcements = 104,
        Contacts = 105,
        Events = 106,
        Tasks = 107,
        DiscussionBoard = 108,
        PictureLibrary = 109,
        DataSources = 110,
        WebTemplateCatalog = 111,
        UserInformation = 112,
        WebPartCatalog = 113,
        ListTemplateCatalog = 114,
        XMLForm = 115,
        MasterPageCatalog = 116,
        NoCodeWorkflows = 117,
        WorkflowProcess = 118,
        WebPageLibrary = 119,
        CustomGrid = 120,
        DataConnectionLibrary = 130,
        WorkflowHistory = 140,
        GanttTasks = 150,
        Meetings = 200,
        Agenda = 201,
        MeetingUser = 202,
        Decision = 204,
        MeetingObjective = 207,
        TextBox = 210,
        ThingsToBring = 211,
        HomePageLibrary = 212,
        Posts = 301,
        Comments = 302,
        Categories = 303,
        IssueTracking = 1100,
        AdminTasks = 1200,
    }

 

Finally, for your custom action, use the ListTemplateId.  This will allow the ECB item to only appear in these list types.  If you create additional lists based on this template, these lists will also have the custom ECB item appear.

 

Code Snippet

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
  Id="Litware.MyCustomList"
  RegistrationType="List"
  RegistrationId="ListTemplateType"
  ImageUrl="/_layouts/images/GORTL.GIF"
  Location="EditControlBlock"
  Sequence="300"
  Title="View Additional Information" >
  <UrlAction Url..." />
</CustomAction>
</Elements>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值