0

I have a custom ribbon action that I want to add to my specific list called "Meeting", it's a calendar type list..

My custom action XML is as follows:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
  Description="View Agenda"
  Title="View Agenda"
  Id="{A6A6E30B-FB11-4CB3-8D39-3D1159CED532}"
  Location="CommandUI.Ribbon.DisplayForm"
  RegistrationId="Meeting"
  RegistrationType="List"
  Sequence="5"
  Rights="ViewListItems"
  xmlns="http://schemas.microsoft.com/sharepoint/">
    <CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
      <!-- Define the (UI) button to be used for this custom action -->
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.ListForm.Display.Manage.Controls._children">
          <Button Id="{F984D5B5-5474-4C1E-BF9C-713C67E70F2A}"
          Command="{A9424973-D302-4D7D-98B9-7489B6682780}"
          Image32by32="~/_layouts/15/ViewAgenda.png"
          Image16by16="/_layouts/15/ViewAgenda.png"
          Sequence="5"
          LabelText="View Agenda"
          Description="View Agenda"
          TemplateAlias="o1"/>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <!-- Define the action expected on the button click -->
        <CommandUIHandler Command="{A9424973-D302-4D7D-98B9-7489B6682780}" CommandAction="~site/SitePages/Agenda.aspx" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>

But it doesn't work for me, but when I changed RegistrationId="108", all calendar type list has my custom ribbon action. How would I change this code to make it for specific list (Only for Meetings list). Note: I don't want to go for content types.

Thanks

  • 1
    If I can ask, why do not you want to use a specific content type for the Meeting list and then deploy the action for that content type? – Nk SP Aug 14 '15 at 8:33
  • There are limitations in client side. Using content type is not a solution here. I have tried RegistrationId="Some_List_Guid" as well. But it's not working – Sivakumar Piratheeban Aug 14 '15 at 8:40
1

Assigning a list guid to registration id is not possible.

In your case you would need to have a specific list-template-id or content type assigned to this list and assign this to the registration id. You get a custom listtemplate-id if you create a list definition in a solution and create a new instance of this list.

Otherwise you could use the "EnabledScript" Attribute for CommandUIHandler where you write in javascript for example the condition in which the Custom Action should be enabled. This would mean that the Ribbon is also in every list but not enabled.

1

You can use the EnabledScript attribute to enable the action just for your Meeting List.

<CommandUIHandler 
  Command="Ribbon.ListItem.CustomGroup.Controls.BtnSayHello.Command"
  CommandAction="javascript:doYourStuff();"
  EnabledScript="javascript:
    function isEnable(){
      if(SP.ListOperation.Selection.getSelectedList() == "meeting list GUID"){
        return true;
      }
      return false;
    }
    isEnable();"
/>
  • It's not working for me – Sivakumar Piratheeban Aug 14 '15 at 10:00
  • <CommandUIHandlers> <!--<CommandUIHandler Command="{A9424973-D302-4D7D-98B9-7489B6682780}" CommandAction="~site/SitePages/Agenda.aspx" />--> <CommandUIHandler Command="Ribbon.ListForm.Display.Manage.Controls._children" CommandAction="javascript:doYourStuff();" EnabledScript="javascript: function isEnable(){ if(SP.ListOperation.Selection.getSelectedList() == {2569E1AB-790D-445C-8D57-A57F53C2879E}){ return true; } return false; } isEnable();" /> </CommandUIHandlers> – Sivakumar Piratheeban Aug 14 '15 at 10:00
  • 1
    try to alert(SP.ListOperation.Selection.getSelectedList()) . I think u need == "2569E1AB-790D-445C-8D57-A57F53C2879E" – Nk SP Aug 14 '15 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.