SharePoint MOSS/WSS-How to remove the "Download a Copy" context menu from a Document Library

Source: Internet
Author: User

One of my friend and colleague asked me this question. I found it tricky and a good post for my blog. Here's what we have to do:

Go to your hive\template\layouts\1033 folder. Open up the Core.js file. Find the function Addsendsubmenu. Go to the last 3 lines:

"Stsnavigate ('""/_layouts/download.aspx?" ) "Sourceurl=" "&source=" "&fldurl=" " ')""" ""id_downloadacopy";

Now if you want to remove "Download a Copy" option from the document libraries then comment all three lines.

If you want to remove it for some custom List Definition so you have the created you could do like:

if  (ctx.listtemplate!=10001) {straction =  "S Tsnavigate (' " + CTX. Httproot +  "/_layouts/download.aspx?"  +  "sourceurl="  + Currentitemescapedfileurl +  "&source="  + getsource () +  "&fldurl="  + escapeproperly (ctx. Sendtolocationurl) + ;; Menuoption = camopt (SM, L_downloadacopy_text, straction, ); Menuoption.id =  "id_downloadacopy" ;} 

Where 10001 was your The custom list template ID.

If you want to does it for a specific the Document Library then you would does like this:

if  (ctx.listname!= "{ 28958b49-8c76-4987-815c-cf5a107ff522} "" {straction =  "stsnavigate ('"  + CTX.) Httproot +  "/_layouts/download.aspx?"  +  "sourceurl="  + Currentitemescapedfileurl +  "&source="  + getsource () +  "&fldurl="  + escapeproperly (ctx. Sendtolocationurl) + ;; Menuoption = camopt (SM, L_downloadacopy_text, straction, ); Menuoption.id =  "id_downloadacopy" ;} 

As you can see you has to pass the list GUID as ListName.

SharePoint MOSS/WSS-How to remove the "Download a Copy" context menu from a Document Library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.