locked
Remove item from menu RRS feed

  • Question

  • Hi,

    I would like to remove item in menu only for folders in document library. So for example I have created new item in ECB which is named "Report" and it's available for all items in document library, but I wouldn't like to got this in Folder item.

    Please help.

    Thank you

    Wednesday, February 2, 2011 4:40 PM

All replies

  • There is not any way to hide your "Report" ECB menu item by using custom action in Feature but you have to use custom javascript to do this.

    First go through this article

    How to: Hide a Menu Item in the ECB from SharePoint List Items

    then

    Hide "Delete Item" from ECB menu for 1 specific custom list

    you have to research little bit to find reference of the folder in javascript.

     


    w: http://www.worldofsharepoint.com | t: @sharesandip
    Thursday, February 3, 2011 6:01 AM
  • Hi, I created new item in ECB menu using feature in Sharepoint. Is there easy way to hide them for specified items using HideCustomAction also as feature where I check if item is folder and use it only for this folder item ?

    With using JavaScipt it doesn' work or maybe a don't know how to do it ?

    I found some information:

    • The "HideCustomAction" feature can merely hide the items which have been rendered through the "CustomAction" framework features such as Site Actions and Site Setting etc.
    • ECB (Context Menu) items are rendered by JavaScript from the Core.js file so we can't hide them via the "HideCustomAction" feature. However, you can add a new menu item in the ECB menu through the "CustomAction" feature and hide it again through the "HideCustomAction" feature. In other words, the "HideCustomAction" feature can be used to hide the ECB menu items that you created via CustomAction, but can't be used to hide the out of the box menu items.
    So it's possible to hide CustomAction using HideCustomAction only for some items in the library, for example only for folders ?
    Thursday, February 3, 2011 9:43 AM
  • Unfortunately some menu items are added during runtime and therefore can't be removed with a HideCustomAction.

    I had a similar task once. My client wanted me to remove the "Edit in SharePoint Designer" menu item in the SiteAction menu.

    I created a CustomAction refering to my own ControlClass. In the OnLoad of my extended WebControl i wrote the following code :

    protected override void OnLoad(EventArgs e)
    
    {
    
     var fakeMenuButton = ToolBarMenuButton.GetMenuControl(this);
    
     fakeMenuButton.PreRender += (sender, eventArgs) =>
    
     {
    
      var editSPDMenuButton = fakeMenuButton.GetMenuItem("MenuItem_EditSite");
    
    
    
      if (editSPDMenuButton != null)
    
       fakeMenuButton.MenuControl.HiddenMenuItems.Add(editSPDMenuButton);
    
     };
    
    }
    
    
    
    

    Don't you just love reflector :-P
    Tuesday, May 10, 2011 1:00 PM