SharePoint 2007 Document Library ContextMenu Hiding

SharePoint 2007 Document Library ContextMenu Hiding

First locate yourself to the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033 fine the core.js. From where the context menu item script runs for SharePoint 2007 Document Library.

Lets hide the "Download A Copy" menu under the "Send To" Context menu. Open the core.js file in best .js file editor. And search for the function function AddSendSubMenu(m,ctx).
Where you can see

menuOption=CAMOpt(sm, L_DownloadACopy_Text, strAction, "");"ID_DownloadACopy";

these lines of code which will display text "Download A Copy" and call the menu operation, just comment those lines and save.

This is the simple way to hide the contextmenu item in the document library.


Madhur said…
This will affect all document libraries.
How to do it for particular document library ?

One way is you need to change the master page. Open the SharePoint site using the SharePoint Designer and go to the default master which is used in the document library you need to modify. Do another copy the master page and
SharePoint:ScriptLink language="javascript" name="core.js" Defer="true" runat="server"
And change the core.js to your customizeds core.js and save it.

And now open your document library in SharePoint designer and change the default master page to your custom master page
Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c"

Hope this helps
Jaime said…
Do you know that if you change this file you will lost Microsoft support for Sharepoint???

You mean to say core.js file?
Is it? Interesting!
Then what is the better solution ?

Popular posts from this blog

ASP.NET website "Cannot read configuration file due to insufficient permissions" in IIS 7 and Windows Server 2008

Error occurred in deployment step 'Install app for SharePoint': The System Account cannot perform this action.

None of the selected features can be installed or upgraded. Setup cannot proceed since no