SharePoint Bending: Remove “Send To” Context Menu Without Modifying Core.JS
This is becoming a pretty common requirement. Some people just don’t want the “Send To” menu appearing in the context menu of the document library. You can do it — customize the SharePoint context menu by — by simply making some modification in core.js as suggested by many.
But modifying SharePoint core files should not be done, because your modifications can be overwritten by future SharePoint updates. So here’s a little trick to remove the “Send To” context menu without modifying core.js:
- Go to the document’s view url, for example:
http://example.com/Documents/Forms/AllItems.aspx. - If it is a web part page, edit the page and add a Content Editor web part. Otherwise you need to edit that page in SharePoint Designer.
- Open the source editor (not the rich editor) for the Content Editor web part, or open the code view (not the design view) of that particular page in SharePoint Designer.
- Either inside the web part or the code view, insert the following script:
<script type="text/javascript">
AddSendSubMenu = function (m,ctx) {}
</script>
That script will redefine the AddSendSubMenu() function with a new implementation. Since the function body is empty, it simply won’t display anything, thus the “Send To” context menu is removed from the context menu.
You can do this on some pages manually, or if you want to apply this to all pages, just insert the code to your master page.
Tags: javascript, sharepoint
July 31st, 2008 at 5:23 pm
hi
i worked as u explained but its not working fine, on doc library i have created content editor webpart & pasted the java script in source editor, only once its not displaying the ‘Send to’ option & when i go to home page & come back to doc lib then again i can able to see the ‘Send to’ option i.e again displaying……….its not working in designer toooo, when i have pasted in code of designer then its throwing an error(i.e., its displaying full java script code again in error, saying parser error)
August 12th, 2008 at 1:31 pm
Hi vidurasai,
Please make sure you checkin and publish your page after making the changes.