none
SPO : How to hide context menu items in custom list ? RRS feed

  • Question

  • Hello,

     Can anyone tell me how I can hide “Share” and “Advanced” menu from SharePoint custom list from “AllItems.aspx” view ?

     Looking into an old post, I learned this hides “Delete” menu.

    var style
    = $("<style type='text/css' id='hideDeleteButton'> #ID_DeleteItem
    {display:none}</style>");
                           
    $("head").append(style);

    Similarly, I found this hides “View” menu.

    var style
    = $("<style type='text/css' id='hideViewButton'> #ID_ViewItem
    {display:none}</style>");
    
    $("head").append(style);

    But this trick doesn’t work for “Share” and “Advanced” menu.

    Thanks for your help!

    Saturday, January 5, 2019 8:25 PM

Answers

  • It turned out the IDs for these menu items are

    • ID_Share
    • ID_DeleteItem
    • ID_EditItem
    • ID_ViewItem
    • ID_AdvancedMenu

    So, to hide the "Share" and "Advanced" menu items, this tiny JavaScript can do the trick.

        var style = $("<style type='text/css' > #ID_Share {display:none} #ID_AdvancedMenu {display:none}</style>");
        $("head").append(style);

    ---

    For SharePoint Online users, who doesn't have a copy of local "core.js", you can still peek as follows.

    1. Open the HTML source file, to locate the line something below.

    RegisterSod("core.js", "https:\u002f\u002fstatic.sharepointonline.com\u002fbld\u002f_layouts\u002f15\u002f16.0.8412.1210\u002fcore.js");RegisterSodDep("core.js", "strings.js");

    2. Replace "\u002f" with "/" to get this URL

    https://static.sharepointonline.com/bld/_layouts/15/16.0.8412.1210/core.js

    3. Copy-and-past this URL to your browser.

    This is how I found these menu IDs.


    • Marked as answer by Tony_I921 Saturday, January 5, 2019 11:07 PM
    • Edited by Tony_I921 Sunday, January 6, 2019 7:17 PM
    Saturday, January 5, 2019 11:06 PM