Hiding the Context menu item of a Document Library in a SharePoint



Hiding the Context menu item of a Document Library in a SharePoint

Sometimes we found that the some context menu (like "Alert Me", "WorkFlow", etc) in Document Library's is not required for the users, One of my client asked me to take iout the "Alert Me" menu...After some R&D :), i addressed the client requirement

There is a function called "CAMOpt" in Core.JS, this function is used to add new item in ListItem's context menu...the above requirement can be done by writing a new "CAMopt" JS function to override the Core.JS's "CAMOpt" JavaScript method

i wrote a new function (called CAMOpt) to override CMOpt


JS funciton in
Core.JS...

function CAMOpt(p,wzText,wzAct,wzISrc,wzIAlt,wzISeq,wzDesc)
{
var mo=CMOpt(wzText,wzAct,wzISrc,wzIAlt,wzISeq,wzDesc);
if(!mo)return null;
if(wzText != "Alert Me") AChld(p,mo);
return mo;
}






New overriden JS funciton in document library's allitems page...


function CAMOpt(p,wzText,wzAct,wzISrc,wzIAlt,wzISeq,wzDesc)
{
var mo=CMOpt(wzText,wzAct,wzISrc,wzIAlt,wzISeq,wzDesc);
if(!mo)return null;
if(wzText != "Alert Me") AChld(p,mo);
return mo;
}






Context menu item of ListItem could be Edited/Deleted/Added by using above approach...