none
Custom Ribbon Button on Wiki Page's Editing Tools Ribbon RRS feed

  • Question

  • I'm trying to get a custom ribbon button on the Wiki's ribbon, ideally the Editing Tools > Format Text > Markup group.  I've deployed the solution but nothing appears to be showing up in the ribbon.  Any thoughts on where I've gone wrong?

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
     <CustomAction Id="WikiExtensions.Ribbon.EditingTools"
            Location="CommandUI.Ribbon"
            RegistrationId="119"
            RegistrationType="List"
            Sequence="20">
      <CommandUIExtension>
       <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.EditingTools.CPEditTab.Markup.Controls._children">
         <Button Id="WikiExtensions.Ribbon.InsertCodeBlock"
             Alt="Notify hello"
             Sequence="5"
             Command="WikiExtensions.Command.InsertCodeBlock"
             Image16by16="/_layouts/images/NoteBoard_16x16.png"
             Image32by32="/_layouts/images/NoteBoard_32x32.png"
             Description="Uses the notification area to display a message."
             LabelText="Notify hello"
             TemplateAlias="o1" />
        </CommandUIDefinition>
       </CommandUIDefinitions>
       <CommandUIHandlers>
        <CommandUIHandler
         Command="WikiExtensions.Command.InsertCodeBlock"
         CommandAction="javascript:
         
         SP.UI.Notify.addNotification('Hello from the notification area'); 
         " />
       </CommandUIHandlers>
      </CommandUIExtension>
     </CustomAction>
    </Elements>
    

    Thursday, January 27, 2011 2:40 PM

Answers

  • Did you try the exact code above? Make sure your location is CommandUI.Ribbon and that you're not scoping it by using RegistrationId/RegistrationType. Those will make it only apply to the specified list type. It works for me on my Foundation-only install.

    Also, did you clear your browser cache? This may mean going into the Temporary Internet Files folder, selecting everything, and pressing delete. The ribbon is very aggressive with caching for performance reasons.

     

    -Dallas

    • Marked as answer by ColinBowern Friday, January 28, 2011 5:25 PM
    Friday, January 28, 2011 5:13 PM

All replies

  • Colin,

    There are a couple of things here. First, your have a RegistrationId of 119, which is for a Web Page Library. This isn't a Web Page Library, so the customization will not show up. The second thing is that you're trying to add to TemplateAlias o1. That TemplateAlias does not exist for this group. This group is defined using Ribbon.Templates.LargeThreeMediumDoubleTop as the template (found on the Group declaration in CMDUI.xml). This group doesn't have an overflow section defined, so the only way to modify this group is to replace a button at one of the TemplateAlias locations defined for it (c1, c2a, c2b, c3, c4; again, found in CMDUI.xml).

    Hope this helps,
    Dallas
    Friday, January 28, 2011 12:44 AM
  • Is there an example of adding to the wiki's editing tools ribbon available?   I dropped the RegistrationId and TemplateAlias properties, tried changing to the Ribbon.EditingTools.CPEditTab.Styles section and it's still not showing up.
    Friday, January 28, 2011 1:03 AM
  • You can't just drop TemplateAlias. TemplateAlias is required for the button to know how to render. In order to add to the Styles group, you'll need to refer to the Flexible template to find an acceptable TemplateAlias. Flexible does have an overflow section, so you can use o1 for the TemplateAlias. Here is an example:

        <CustomAction Id="WikiExtensions.Ribbon.EditingTools"

               Location="CommandUI.Ribbon"

               Sequence="20">

          <CommandUIExtension>

            <CommandUIDefinitions>

              <CommandUIDefinition Location="Ribbon.EditingTools.CPEditTab.Styles.Controls._children">

                <Button Id="WikiExtensions.Ribbon.InsertCodeBlock"

            Alt="Notify hello"

            Sequence="5"

            Command="WikiExtensions.Command.InsertCodeBlock"

            Image16by16="/_layouts/images/NoteBoard_16x16.png"

            Image32by32="/_layouts/images/NoteBoard_32x32.png"

            Description="Uses the notification area to display a message."

            LabelText="Notify hello"

            TemplateAlias="o1" />

    This shows up right before the other buttons in the Styles group.

     

    Friday, January 28, 2011 1:19 AM
  • I tried the code snippet posted above, but it still isn't showing up.  When I change the Location to Ribbon.Documents.EditCheckout I see it in a document library.  What else am I missing to get the button into the wiki page editing tools?  I'm deploying to SharePoint Foundation if that matters.

    Friday, January 28, 2011 3:29 PM
  • Did you try the exact code above? Make sure your location is CommandUI.Ribbon and that you're not scoping it by using RegistrationId/RegistrationType. Those will make it only apply to the specified list type. It works for me on my Foundation-only install.

    Also, did you clear your browser cache? This may mean going into the Temporary Internet Files folder, selecting everything, and pressing delete. The ribbon is very aggressive with caching for performance reasons.

     

    -Dallas

    • Marked as answer by ColinBowern Friday, January 28, 2011 5:25 PM
    Friday, January 28, 2011 5:13 PM
  • That was it - aggressive caching.  Once I cleared the browser history it showed up.  Thanks for your help!
    Friday, January 28, 2011 5:25 PM
  • Great! Glad I could help. :)

     

    Take care,

    Dallas

    Friday, January 28, 2011 5:27 PM