1).
SharePoint 2007 (MOSS/WSS) - how to remove "Download a Copy" context menu from a Document Library
http://blogs.msdn.com/b/pranab/archive/2008/12/06/sharepoint-2007-moss-wss-how-to-remove-download-a-copy-context-menu-from-a-document-library.aspx
SharePoint 2010:
Here is what I did:
1. Added a Content Editor webpart to the AllItems.aspx page
2. Added following HTML into the HTML source of CEWP.
http://blogs.msdn.com/b/pranab/archive/2008/12/06/sharepoint-2007-moss-wss-how-to-remove-download-a-copy-context-menu-from-a-document-library.aspx
SharePoint 2010:
Here is what I did:
1. Added a Content Editor webpart to the AllItems.aspx page
2. Added following HTML into the HTML source of CEWP.
<style>
A[id$='Ribbon.Documents.Copies.Download-Large'] {
DISPLAY: none
}</style>
2).Removing "Download a Copy"
How to hide the download a copy option (Context Menu) in the Document Library
In the document library we have an option of downloading the document as shown below.
If the user wants to hides or remove this option for all the users. The following steps will explain the same.
1. First locate the following path C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033
2. Find the file named “CORE.js”. This is the file which will run the scripts downloading option for the document library.
3. Open the core.js file in best .js file editor and search for the function
AddSendSubMenu(m,ctx)
Where you can see
menuOption=CAMOpt(sm, L_DownloadACopy_Text, strAction, "");
menuOption.id="ID_DownloadACopy";
menuOption.id="ID_DownloadACopy";
These lines of code which will display text "Download A Copy" and call the menu operation.
So, comment the code and save the file.
4. Now when you search the context menu (Download a copy) option will be hidden as shown in the following figure.
Disadvantage
The above solution will affect all the document libraries of the SharePoint Server.
So, how to do it a particular document library or one web collection?
Hence the solution is as follows:
1. Open the default.master page in the designer.
2. Locate the core.js in the master page
<SharePoint:ScriptLink language="javascript" name="core.js" Defer="true" runat="server"/>
3. So we can create our own (with the modifications as shown above) .js file (example named customcore.js) and save it in the following location
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033
4. Now we can add the reference as shown below.
<SharePoint:ScriptLink language="javascript" name="customcore.js" Defer="true" runat="server"/>
5. Now it won’t affect all the document libraries in the SharePoint server.
Bingo. We are done. We have restricted users to download the documents from the SharePoint Document library.
No comments:
Post a Comment