SharePoint Solutions….by HG Ask me! SharePoint is fun to play with :)

21Jul/090

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

About Hong Gyem Kim

Sr. SharePoint Solutions Architect at HCONN; Microsoft SharePoint Virtual Technology Solutions Professional (TSP); Microsoft Certified Professional Developer (MCPD): Web Developer; Microsoft Certified Technology Specialist (MCTS); Microsoft Certified IT Professional Specialist (MCITP): Enterprise Messaging Administrator; Microsoft Achievement: Delivering Value Planning Services; Microsoft Certified Professional (MCP);
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment



No trackbacks yet.