1

In one of my POC, there is a requirement to create custom action Ribbon menu for Task List. After lot of research I have tried below code snippet in empty module to add custom action.

<CustomAction Id="ActionButton" RegistrationId="107" RegistrationType="List" Location="CommandUI.Ribbon" Title="Add a Action button for tasks list">
 <CommandUIExtension>
  <CommandUIDefinitions>
    <CommandUIDefinition Location="Ribbon.Tasks.Actions.Controls._children">
      <Button Id="Ribbon.Tasks.Actions.ActionButton"
              Alt="Perform an action for task items."
              Sequence="10"
              Command="ActionButtonCommand"
              LabelText="Action Button"
              TemplateAlias="o1"
              Image32by32="/_layouts/15/ActionRibbon/img/action-32x32.png"
              Image16by16="/_layouts/15/ActionRibbon/img/delete-all-16x16.png" />
    </CommandUIDefinition>
  </CommandUIDefinitions>
  <CommandUIHandlers>
    <CommandUIHandler Command="ActionButtonCommand" CommandAction="javascript:alert('Whoa..! You performed an action!');">
    </CommandUIHandler>
  </CommandUIHandlers>
</CommandUIExtension>

I have made sure that RegistrationId for Tasks list is 107. Also checked this Location for CommandUIDefinitation.

When I try to add the same custom action to the any of the task list from SharePoint designer and specify the location Ribbon.Tasks.Actions.Controls._children. Custom Action does appear but, when I do the same with Visual studio as farm solution, custom action does not appear at all.

Can some one help me? It would be great help. Thanks in advance.

2
  • Make sure you run InPrivate or do CTRL+F5 so that the ribbon isn't fetched from the browser cache Dec 11, 2014 at 15:01
  • Thank you for response Steven. Yes, I have tried that too many times. Also when I try to change the target list to custom list by changing RegistrationId to 100 and change location accordingly, it does work. Only case here it is not working for Task list.
    – Pradip R.
    Dec 11, 2014 at 15:07

1 Answer 1

0

Well, After digging lot into web I found out that the RegistrationID for Tasks List is 171 from this link, so below code block has worked for me:

<CustomAction Id="ActionButton" RegistrationId="171" RegistrationType="List" Location="CommandUI.Ribbon" Title="Add a Action button for tasks list">
 <CommandUIExtension>
  <CommandUIDefinitions>
    <CommandUIDefinition Location="Ribbon.Tasks.Actions.Controls._children">
      <Button Id="Ribbon.Tasks.Actions.ActionButton"
              Alt="Perform an action for task items."
              Sequence="10"
              Command="ActionButtonCommand"
              LabelText="Action Button"
              TemplateAlias="o1"
              Image32by32="/_layouts/15/ActionRibbon/img/action-32x32.png"
              Image16by16="/_layouts/15/ActionRibbon/img/delete-all-16x16.png" />
    </CommandUIDefinition>
  </CommandUIDefinitions>
  <CommandUIHandlers>
    <CommandUIHandler Command="ActionButtonCommand" CommandAction="javascript:alert('Whoa..! You performed an action!');">
    </CommandUIHandler>
  </CommandUIHandlers>
 </CommandUIExtension>
</CustomAction>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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