SharePoint 2007 (MOSS/WSS) - how to remove "Download a Copy" context menu from a Document Library
One of my friend and colleague asked me this question. I found it tricky and a good post for my blog. Here is what you have to do:
Go to your 12 hive\TEMPLATE\LAYOUTS\1033 folder. Open up the Core.js file. Find the function AddSendSubMenu. Go to the last 3 lines:
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";
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
Now if you want to remove "Download a Copy" option from all the document libraries then comment all three lines.
If you want to remove it for some custom List Definition that you have created you may do like:
if(ctx.listTemplate !=10001)
{ 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";
}
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
Where 10001 was your custom list template id.
If you want to do it for a specific Document Library then you would do 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";
}
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
As you can see you have to pass the list GUID as listName.
SharePoint 2007 (MOSS/WSS) - how to remove "Download a Copy" context menu from a Document Library的更多相关文章
- How to remove unwant Internet Explorer Context Menu
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt
- SharePoint Designer定制MOSS/WSS表单页面
转:http://blog.csdn.net/yl_99/article/details/7087897 方法一.使用SharePoint Designer配合enderingTemplate文件来定 ...
- Extending your SharePoint 2007 site with Microsoft ASP.NET AJAX 3.5
After ASP.NET 3.5 has been installed you need to modify the web.config file of your MOSS web site wi ...
- SharePoint 2007 页面定制(一)
转:http://www.nanmu.net/SharePoint-MOSS-WSS-Silverlight/Lists/Posts/Post.aspx?ID=74 本文主要包括以下几方面内容: 1. ...
- 在Vista或Windows 7系统上安装Sharepoint 2007
在Vista或Windows 7系统上安装Sharepoint 2007 2010-03-05 18:53:19| 分类: 技术文章|字号 订阅 SharePoint 2007 不能直接安装 ...
- SharePoint 2007 form.js兼容性修改
因SharePoint 2007发布时微软的主要IE的版本是7,所以其中不少的JS是不规范的,在新的IE8 9 10 11等版本中碰到不少的问题,以下是部分的修复,记录下,不断完善. ()语法问题 d ...
- SharePoint Document Library中的"Versioning Settings"功能与CSOM的对应
博客地址:http://blog.csdn.net/FoxDave SharePoint文档库关于版本的设置:"Versioning Settings",可以通过CSOM用L ...
- PowerShell 批量签入SharePoint Document Library中的文件
由于某个文档库设置了编辑前签出功能,导致批量导入文件时这些文件默认的状态都被签出了.如果手动签入则费时费力,故利用PowerShell来实现批量签入Document Library中的文件. Reso ...
- SharePoint 2013 Step by Step—— How to Upload Multiple Documents in Document Library
How to Upload Multiple documents in SharePoint 2013,Options to add multiple files in a document libr ...
随机推荐
- EntityFramework、Dapper vs 草根框架性能
EntityFramework.Dapper vs 草根框架性能 扯淡 当前市面上 ORM 很多,有跑车型的,如 Dapper,有中规中矩型的,如 Mybatis.Net,也有重量型的,如 Entit ...
- setPluginsEnabled(true) 谁知道android的4.3之后为什么会报错
我也是最近才遇到这个问题的,查了下资料,setPluginEnable已经弃用了,使用webSettings.setPluginState(WebSettings.PluginState.ON);可以 ...
- MyBatis 最常见错误,启动时控制台无限输出日志
你是否遇到过下面的情况,控制台无限的输出下面的日志: Logging initialized using ‘class org.apache.ibatis.logging.log4j.Log4jImp ...
- 嵌入式davinci电路元素基础和PWM模块
1,DAC_OUT和DAC_OUTB是AD9912输出的差分信号. 2,电容器储存电荷的能力,常用的单位是F.uF.nF.pFUF大了好还是UF小了好,要根据电路自身需要而设计, 要看电路滤波是在高频 ...
- C++编程学习52个经典网站 强力推荐
C/C++是最主要的编程语言.这里列出了50名优秀网站和网页清单,这些网站提供c/c++源代码.这份清单提供了源代码的链接以及它们的小说明.我已尽力包括最佳的C/C++源代码的网站.这不是一个完整的清 ...
- git Feature分支
Feature分支 软件开发中,总有无穷无尽的新的功能要不断添加进来. 添加一个新功能时,你肯定不希望因为一些实验性质的代码,把主分支搞乱了,所以,每添加一个新功能,最好新建一个feature分支,在 ...
- csu 1563 Lexicography
题意:给出一堆字母 问这些字母组成的字符串中第k大的 排列组合,具体看代码 //寒假集训被何柱大大踩好惨(>_<) #include<cstdio> #include<i ...
- poj1656---数黑格子
题意:有white,black,test操作 black将给定范围涂黑,white将给定范围涂白,test将给定范围的黑格子数出来并且输出 思路:无论哪个操作格子范围都在 (x,y) (x+L-1 ...
- oracle 建表后添加表注释及字段注释
oracle添加表注释和表字段注释 创建Oracle数据库表时候加上注释 CREATE TABLE t1(id varchar2(32) primary key,name VARCHAR2(8) N ...
- windows 7 memcached报failed to install service or service already installed的解决方案
今天心血来潮捣鼓一下memcache,由于系统是windows 7,我参考了 Windows下安装Memcache 使用memcached for Win32. 在运行memcached.exe -d ...