none
[Ribbon Customization] Override "Delete page" button of the Ribbon RRS feed

  • Question

  • Hi all!

    I'm trying to replace the "Delete page" button from the ribbon and replace it with my own delete button with custom code. I was able to remove the "Delete page" button from the ribbon with following code:

    SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);
    if (ribbon != null)
    {
       ribbon.TrimById("Ribbon.WikiPageTab.Manage.DeletePage");
    }

    But I become crazy adding my own button in place of the old one. I try several things, but nothing works!!!

    I add a module (attached to a feature) within my SharePoint Project and add following xml code in this module:

     <CustomAction Id="Ribbon.WikiPageTab.Manage.DeletePage1Action"
            Location="CommandUI.Ribbon">
      <CommandUIExtension>
       <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.WikiPageTab.Manage.Controls._children">
         <Button Id="Ribbon.WikiPageTab.Manage.DeletePage1"
             Sequence="45"
             LabelText="Delete page"
             TemplateAlias="o2"
             Image16by16="/_layouts/images/FILMSTRP.GIF"
             Image32by32="/_layouts/images/PPEOPLE.GIF"
             ToolTipTitle="Delete the current page"
             ToolTipDescription="This will delete the current page" />
        </CommandUIDefinition>
       </CommandUIDefinitions>
      </CommandUIExtension>
     </CustomAction>
    

    But nothing is displaying.... :-(. WTF??? Just before this "CustomAction", I have another "CustomAction" (that is adding an ItemMenu in the SiteActions menu) that works perfectly.

    I think I have some false reference on an ID or LOCATION.... but I can't find out what!!!

    Thanks in advance for you help!

    Regards,

    Bastien

     

     

     


     

    Friday, January 7, 2011 3:54 PM

Answers

  • ;)

    I think Microsoft has some issue with Feature deployment....

    My code was OK, but modifications of my CustomAction were not taken into account after deployment!

    When I modify or add some stuff in my CustomAction, I need to:

    1. Delete the feature containing my CustomAction module
    2. Create a new feature
    3. Attach the CustomAction module to this new feature
    4. Re-Deploy the solution
    It's a little bit boring.... if someone has another solution, I'm all ears :-).

    • Marked as answer by bPlatypus Monday, January 10, 2011 1:45 PM
    Monday, January 10, 2011 10:43 AM

All replies

  • monday up :-)
    Monday, January 10, 2011 7:56 AM
  • ;)

    I think Microsoft has some issue with Feature deployment....

    My code was OK, but modifications of my CustomAction were not taken into account after deployment!

    When I modify or add some stuff in my CustomAction, I need to:

    1. Delete the feature containing my CustomAction module
    2. Create a new feature
    3. Attach the CustomAction module to this new feature
    4. Re-Deploy the solution
    It's a little bit boring.... if someone has another solution, I'm all ears :-).

    • Marked as answer by bPlatypus Monday, January 10, 2011 1:45 PM
    Monday, January 10, 2011 10:43 AM
  • Try to clear the browser cache. Thats a common ribbon development issue.
    Friday, August 24, 2012 3:35 PM