Hide "New" document menu item in document library views
Recently my customer asked me to do something I generally
do not approve of - changing the basic behavior of a SharePoint
I usually for maintaining a solid user
experience and believe it is one of the many strong point SharePoint has
to offer by giving the user a familiar environment throughout his LOB
systems - if it’s a team workspace, an internal organization portal or
(new in 2007) the organization internet portal.
Well, with all
that said - one of my customers still insisted on removing the "new"
document menu item from all the document libraries and allowing only to
Like a good SharePoint-boy I immediately thought my solution will be creating a new feature that uses the tag for hiding different menu items in SharePoint.
To my surprise I learned that the “new” menu item in the list view web part tool bar is not listed as a in any feature, so it cannot be removed as so.
Finding no other choices, I created this JS code in a separate JS file and referenced it from all master pages involved…
If checks if the current page has a document library view and if so – locate and hide its “new” menu item…
Just add it to your page, and call HideNewDocumentMenuItem on body’s load:
if( ctx )
if( ctx.listBaseType == 1 )
var tables = document.getElementsByTagName("table");
for(var i=0; i< tables.length; i++)
if( tables[i].id.indexOf("NewMenu") > 0 )
var elm = tables[i];