none
Custom Action for an Specific List

    Question

  • I've been looking for an answer and I googled several sites but so far I didn't find the answer to this particular question, what I want is a Custom Action just to one SPECIFIC LIST.

     

    Here on the forums I found a thread but not answered at all (http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/447a30b2-77bd-465d-aa6e-04fa84daa61a) and the closest best answer was:  http://www.chaholl.com/archive/2010/11/17/using-the-dialog-framework-in-sharepoint-2010.aspx

    The link is great and shows a lot of the topic in a very good example I did learn from the link above but it fails to tell how to apply the same example to a List or to an specific Document Library or an specific List, it is a very generic example affecting all the libraries.

    Since I'm not an experienced developer I couldn't figure out the way to solve and I'm starting this thread to hopefully find an answer and/or an example.

    Thanks!

    Saturday, January 08, 2011 8:17 AM

Answers

  • Hi Dr. Sushi,

    I would recommend that you install the Visual Studio 2010 extensibility project for SharePoint 2010 Ribbons. You can get the project here: http://code.msdn.microsoft.com/vsixforsp

    It provides a new project item type (not a new project type!) which you can then add to an existing SharePoint 2010 project in Visual Studio 2010. It gives you a wizard approach to attaching your new ribbon elements to a specific list (or rather, specific list type).

    Unfortunately, the project doesn't give you a complete designer experience for building ribbons :( you just get some Visual Studio code snippets and skeleton code. But it's so much better than starting from scratch.

    If you've already got your ribbon CAML mainly done, the region you want to look at is the <CustomAction> tag:

    <CustomAction
      Id="Ribbon.Joel" Location="CommandUI.Ribbon.ListView"
      RegistrationId="104" RegistrationType="List">
    ....

    The above code will make sure your ribbon only shows for lists of type 104 (Announcements).

    Alternatively, if you're not an experienced developer, you could make these changes in SharePoint Designer 2010. Open up your list in Designer, and add Custom Actions. You can add them to: the List Item menu (i.e. the drop down menu for a list item), the Display Form Ribbon, the Edit Form ribbon, the New Form ribbon and the View ribbon for that specific list.

    Hope this helps.

     


    joel
    Joel's SharePoint Architect Blog
    joelblogs.co.uk
    Want SharePoint Training?
    Saturday, January 08, 2011 1:15 PM
  • If you only what to "add" some actions to your list, just use SharePoint Designer. In the SPD 2010, select your list or document library, in the ribbon of SPD, It can add custom actions to view/form ribbons and item ECB.
    Sunday, January 09, 2011 2:59 AM

All replies

  • Hi Dr. Sushi,

    I would recommend that you install the Visual Studio 2010 extensibility project for SharePoint 2010 Ribbons. You can get the project here: http://code.msdn.microsoft.com/vsixforsp

    It provides a new project item type (not a new project type!) which you can then add to an existing SharePoint 2010 project in Visual Studio 2010. It gives you a wizard approach to attaching your new ribbon elements to a specific list (or rather, specific list type).

    Unfortunately, the project doesn't give you a complete designer experience for building ribbons :( you just get some Visual Studio code snippets and skeleton code. But it's so much better than starting from scratch.

    If you've already got your ribbon CAML mainly done, the region you want to look at is the <CustomAction> tag:

    <CustomAction
      Id="Ribbon.Joel" Location="CommandUI.Ribbon.ListView"
      RegistrationId="104" RegistrationType="List">
    ....

    The above code will make sure your ribbon only shows for lists of type 104 (Announcements).

    Alternatively, if you're not an experienced developer, you could make these changes in SharePoint Designer 2010. Open up your list in Designer, and add Custom Actions. You can add them to: the List Item menu (i.e. the drop down menu for a list item), the Display Form Ribbon, the Edit Form ribbon, the New Form ribbon and the View ribbon for that specific list.

    Hope this helps.

     


    joel
    Joel's SharePoint Architect Blog
    joelblogs.co.uk
    Want SharePoint Training?
    Saturday, January 08, 2011 1:15 PM
  • If you only what to "add" some actions to your list, just use SharePoint Designer. In the SPD 2010, select your list or document library, in the ribbon of SPD, It can add custom actions to view/form ribbons and item ECB.
    Sunday, January 09, 2011 2:59 AM
  • Hi Team,

    I want to add One Button (In Existing Group) On Custom List (Whose Name is Training & ListID = 6505C0AA-38F0-47A0-A008-F154D00FA509) of SharePoint 2010. That should Display on View Page of any List Item of that Training List.

    It might be possible thorugh SharePoint Designer Studio. But For now i like to understand if i want to do the same through Visual Studio then how would it possible.. Please remember. I want to add this button only on one Custom List i.e. Training Now all other Custom List. And I didn't created my own custom type just use the defualt custom list and name it to Training.

    But Same Time I don't want to add this button in all other Custom List. So, Can anyone help me or guide me what should i mention where in visual studio to add such custom action on perticular list rather than old the list of that type ?


    Thanks & Regards, Brijesh Shah

    Monday, April 02, 2012 8:24 AM
  • Hi Everyone,

       Just thought of sharing the solution for the problem which a lot of developers are facing while adding custom ribbon buttons using Visual Studio. Normally, when you add a custom ribbon button we tend to add the list RegistrationId based on their list types like 100 (custom list), 101(doc library) etc. But the problem using these numbers for registrationId is that if a site contains more lists of same type they all get the custom ribbon button.

      If you need to have a custom ribbon button for just one Specific list, just replace the RegistrationId of CustomAction with the Guid of that particular list.

    For referece below is the sample code..

    <CustomAction
        Id="CustomRibbonTab"
        Location="CommandUI.Ribbon.ListView"
        RegistrationId="{95D9444A-F957-41A6-B024-2C5EA7AB4F44}" //Guid of a particular list 
        RegistrationType="List"
        Title="My Custom UI"
        Sequence="5">
        <CommandUIExtension>
          <CommandUIDefinitions>
            <CommandUIDefinition Location="Ribbon.ListItem.Manage.Controls._children">
              <Button Id="Ribbon.Items.New.RibbonTest"
                      Alt="Stage Button"
                      Sequence="5"
                      Command="UpdateStatus"
                      LabelText="Send for Financial Approval"
                      Image32by32="_layouts/images/siteIcon.png"
                      Image16by16="_layouts/images/siteIcon.png"
                      TemplateAlias="o1"/>
            </CommandUIDefinition>
          </CommandUIDefinitions>


    GSK_2012


    • Edited by GSK_2012 Wednesday, June 20, 2012 3:26 PM
    Wednesday, June 20, 2012 3:25 PM
  • Hi GSK_2012,

    1. I created a custom action successfully and applied to a specific list using registrationid  = {GUID of the list}. This worked fine for the first time.

    2. Then I deleted the list, created another list and copied its guid and replaced it with the previous one in the same feature and elements.xml file. Now this time, its not working, i mean custom action does not get applied to the new list even if i copy paste the guid of the newly created list. If I set registration id as "100". It applies for all custom list, that means my solution is not corrupted, but why is it not working for specific guid of the list as it was working the first time.

    Any Ideas would be greatly appreciated!!!!!!

    Thanks!!!

    Wednesday, October 17, 2012 2:14 PM