Unanswered How to Modify List Item Ribbon?

  • quinta-feira, 18 de março de 2010 19:50
     
     

    Hello,

    Does anyone know a way to modify the ribbon that’s displayed when viewing/editing a list item?  I’ve tried doing this by defining a <CustomAction> element within an Elements.xml file in visual studio, but it appears that you have to know the List ID ahead of time (RegistrationId=ListId) if you're modifying a list-specific ribbon.  Problem is, I have no idea what my list ID is going to be until the solution is deployed (my visual studio solution provisions the list as well), unless I’m missing something. 

    I’ve tried explicitly setting the “Id” property of my list instance in the corresponding CAML to a predetermined value, but it doesn’t seem to stick.  Once the list is created it has a newly generated ID.  I’ve also tried using a variable for the List ID in the CustomAction definition (RegistrationId={$ListId:Lists/LocationsList;}), since that’s what what appears in my exported site template if I add the custom action via SharePoint designer.  Unfortunately this hasn’t worked either.

    Ideally I would like to find a way to modify the ribbon programmatically, but I don’t see a way for that either.  If anyone has any ideas I would greatly appreciate it.

    Thanks,

    Chris

Todas as Respostas

  • terça-feira, 23 de março de 2010 20:20
     
     
    If you are trying to find the list ID in code, have you looked at creating a content type for the list and then finding the list by content type and getting the ID that way? (I don't know if this solution is generic enough for your situation)
  • terça-feira, 23 de março de 2010 22:35
     
     

    I don't have any problem getting the List ID in code after my feature is deployed.  The problem is, the only way I've seen to modify the Ribbon for a list through CAML is to know the List ID ahead of time.  I actually have to reference the List ID in my Elements.xml file that defines my custom actions.

    So I either need a way to establish the List ID before by feature is deployed, so I can put it in the custom action CAML, or I need a way to modify the Ribbon programmatically (when I have List ID) instead of using CAML.  So far I can figure out how to accomplish either.

    Thanks.

  • quinta-feira, 25 de março de 2010 11:45
     
     

    the registration id can be list type as well.. you can replace that with

    set  RegistrationId="101" and    RegistrationType="List" then you can see your custom button in all Document library, 

    http://mosshowto.blogspot.com/2009/04/sharepoint-list-template-ids.html

    here is a full list of id's which you can use, and if you have created any custom library then you need to use id of that list instead of default one.

     


    Regards, Vikas Patel.