I had a curious problem today. I was registering Custom Actions to create a TabGroup with a single Button control on SharePoint’s ribbon:
I did this following Chris O’Brien’s post about “Adding ribbon items to existing tabs/groups“. It worked well, except that as we’re not registering the custom action against a particular list type (e.g. “101”), this button will appear on any list using the tab specified in the CommandUIDefinition‘s Location. In other words, for this example, any list with a ‘Library’ tab:
<CustomAction Id="My.DocumentLibraryTab"
Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Library.Groups._children">
<Group Id="My.DocumentLibraryTab.ClassificationGroup"
Sequence="45"
Description="My Library Classification"
Title="My"
Template="Ribbon.Templates.Flexible">
<Controls Id="My.DocumentLibraryTab.ClassificationGroup.Controls">
<Button Id="My.DocumentLibraryTab.ClassificationGroup.ClassifyList"
Command="My.Command.ClassifyList"
Sequence="45"
Image16by16="/_layouts/images/My/ClassifyList_16x16.png"
Image32by32="/_layouts/images/My/ClassifyList_32x32.png"
Description="Submit an entire Library for classification."
LabelText="Classify Library"
TemplateAlias="o1" />
</Controls>
</Group>
</CommandUIDefinition>
</CommandUIDefinitions>
This was a problem was, this button should only appear for a particular type of list. I changed the CustomAction to register against a particular type of list:
<CustomAction Id="Smartlogic.Semaphore.DocumentLibraryTab"
Location="CommandUI.Ribbon"
RegistrationId="101"
RegistrationType="List">
However, now when I tried navigating to the tab on the list, the ribbon would show ‘Loading’ and hang, and a JavaScript error was thrown. What I found was this error was
Ribbon.Templates.Flexible could not be loaded
Interesting. Armed with that, I did some digging, and then as I came to the same conclusion, I found Andrew Connell’s post ‘Always Create Your Own Group Templates with SharePoint Ribbon Customizations’. The problem was that while I wasn’t registering my TabGroup against a particular type of list, the CMDUI.xml file was being loaded – so the out of the box templates were available. However, once I tried registering the tabgroup against a particular type of list, they weren’t loaded – so the template was unavailable, and hence just script.
So just do what Andrew Connell says – define your own. I ended up copying the one I wanted from CMDUI.xml and including it into my custom action.

Hi,
Is there is a specific way to register the script?
How did you end up “including it into my custom action”
Well, you have to have a CommandUIHandler – and you just put the script into the CommandAction element:
See http://msdn.microsoft.com/en-us/library/ff458385.aspx