Disabling Actions menu items in SharePoint

If you are interested in how to disable menu items in "Actions" menu in SharePoint, you will probably think of several options. You can certainly develop features at site collection level to apply the settings globally. Here, I would like to share a script that you can insert into a Content Editor Web Part. Simply, add a Content Editor Web Part to a page that has a list view web part for a document library and you are all set. You can be creative with this if necessary. 

<script>
function GetElementByText(tagName, title)
    {
        var a = document.getElementsByTagName(tagName);
        for (var j=0; j < a.length; j++)
        {
            if (a[j].text)
            {
                if (a[j].text === title)
                {
                    return a[j];
                }
            }
        }
        return null;
    }
function hideWinExp()
{
 var o = GetElementByText("ie:menuitem","Open with Windows Explorer");
            if (o)
            {
                o.disabled = true;
            }
var p = GetElementByText("ie:menuitem","Edit in Datasheet");
if (p)
            {
                p.disabled = true;
            }
var q = GetElementByText("ie:menuitem","Export to Spreadsheet");
if (q)
            {
                q.disabled = true;
            }
var w = GetElementByText("ie:menuitem","View RSS Feed");
if (w)
            {
                w.disabled = true;
            }
var e = GetElementByText("ie:menuitem","Add to My Links");
if (e)
            {
                e.disabled = true;
            }
}
_spBodyOnLoadFunctionNames.push("hideWinExp");
</script>

Good Luck! Smile

Leave a Reply