Thursday, May 20, 2010

Adding buttons to Mss2010 Ribbon PageActions for Publishing sites

After trying for hours to get a button added to the PageActions-group of the Ribbon. I've managed to find out what i was doing wrong.

Two important things:
* It may be needed to clear your browser's cache to see your Ribbon button appear
* On publishing pages one should not use "Ribbon.WikiPageTab.PageActions" or "Ribbon.WikiPageTab.Actions" as Location. The valid Location is "Ribbon.WikiPageTab.PubPageActions".

This is an example:
<CustomAction Id="Macaw.Wss4.GoogleAnalyticsSolution.GoogleAnalyticsConfigurationPageSettings" Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.WikiPageTab.PubPageActions.Controls._children">
<Button
Id="Ribbon.WikiPageTab.PubPageActions.GoogleAnalyticsConfigurationPageSettings"
Sequence="100"
Command="GoogleAnalyticsConfigurationPageSettings"
LabelText="Google Analytics"
Image16by16="/_layouts/1033/images/formatmap16x16.png" Image16by16Top="-120" Image16by16Left="-32"
Image32by32="/_layouts/1033/images/formatmap32x32.png" Image32by32Top="-192" Image32by32Left="-224"
ToolTipTitle="Google Analytics"
ToolTipDescription="Google Analytics"
TemplateAlias="o2" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="GoogleAnalyticsConfigurationPageSettings" CommandAction="SP.UI.Notify.addNotification('Hello from the notification area');" EnabledScript="true" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>

4 comments:

  1. Great! I passed many hours too, before I read your post! Just had to clear the browser cache...

    ReplyDelete
  2. I want to remove publish,unpublish,cancel buttons from publish menu in wiki library and retain only submit.This is the business requirement.
    I have removed unpublished and cancel for approval buttons, but unable to remove publish form menu.the error is that there is no control with ID Ribbon.PublishTab.Publishing.Publish.Menu.Publish.Publish.
    I have tried with adding usercontrol on masterpage too and above approach also. But unable to get desired status.

    Please help!!!

    ReplyDelete