Add a button to Ribbon.Design.Size group
-
Friday, June 22, 2012 8:52 PM
Hi all,
I need to customize the SharePoint ribbon by adding a button to the Design.Size group that becomes available when an image is selected.
I think my problems are caused by the RegistrationType and RegistrationId elements of the CustomAction tag. I have already tried this without scoping it, or with "FileType" "jpg". Nothing seams to work.
I would appreciate some suggestions.
Here is my code:
<CustomAction
Id="Ribbon.Design.Actions.AddAButton"
Location="CommandUI.Ribbon"
RegistrationType="ContentType"
RegistrationId="Image"
Title="Add a Ribbon Button">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.Design.Size.Controls._children">
<Button Id="Ribbon.Design.Size.NewRibbonButton"
Command="NewRibbonButtonCommand"
Image16by16="/PublishingImages/button16.gif"
Image32by32="/PublishingImages/button32.gif"
LabelText="Hello World"
TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="NewRibbonButtonCommand"
CommandAction="javascript:alert('Hello, world');" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>- Edited by ramoadi Friday, June 22, 2012 9:16 PM
All Replies
-
Friday, June 22, 2012 9:23 PMModerator
Hi
Try setting
RegistrationId="0x01"
and also add the following attribute below RegistrationId:
Sequence="20"
You should also map the images to the _layouts/images folder
Kind Regards Bjoern
Blog- Edited by Bjoern H RappMicrosoft Community Contributor, Moderator Friday, June 22, 2012 9:25 PM
-
Friday, June 22, 2012 10:01 PM
I appreciate your response.
Were you able to get it working with these settings? I've just tried them on and it still doesn't work.
-
Friday, June 22, 2012 10:06 PMModeratorI haven't but I can create a small project and test it out..
Kind Regards Bjoern
Blog -
Friday, June 22, 2012 10:53 PMModeratorFirst of all, the Group location name is Ribbon.Image.Image.Size
Kind Regards Bjoern
Blog -
Monday, June 25, 2012 4:58 PM
I've tried this as well, but it won't work.
I've been able to confirm the correctness of both the RegistrationId (by going to Site Settings > Site Content Types and click to view. The ID is in the URL bar.) and the Group location(by viewing the source of the page. The location is the ID found in the ribbon's div). This is what I have now:
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="Ribbon.Image.Image.Size.Actions.MyButton" Location="CommandUI.Ribbon" RegistrationType="ContentType" RegistrationId="0x01" Sequence="20" Title="Add a Ribbon Button"> <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location="Ribbon.Image.Image.Size.Controls._children"> <Button Id="Ribbon.Image.Image.Size.MyButton" Alt="My custom button" Description="Button description" Command="MyButtonCommand" Image16by16=" _layouts/images/button16.gif" Image32by32=" _layouts/images/button32.gif" LabelText="Hello World" TemplateAlias="o2" /> </CommandUIDefinition> </CommandUIDefinitions> <CommandUIHandlers> <CommandUIHandler Command="MyButtonCommand" CommandAction="javascript:alert('Hello, world');" /> </CommandUIHandlers> </CommandUIExtension> </CustomAction> </Elements>
Everything seams to be good, but for some reason this is not working.
Can anyone think of a reason?
- Edited by ramoadi Monday, June 25, 2012 5:12 PM
-
Monday, June 25, 2012 8:09 PM
I was able to get this working. There is something with the RegistrationType and RegistrationId that is not clicking, but the button will get rendered if they are not specified.
This is probably a hack, that cannot be used if you need a fine grained control over the content type for which the button should be active.
- Marked As Answer by ramoadi Monday, June 25, 2012 8:09 PM

