SharePoint - Hiding Complete Upload option from Form Library

Asked By Rai Nagesh on 09-Mar-12 01:49 AM
Hi All,

I am just going throught to find out hiding the entire Upload option from Form Library, can anybody help me? i tried doing hiding drop down itmes but when i click on Upload Document, i am able to upload the document which i don't want. anybody please help????
Thank you,
rai

Somesh Yadav replied to Rai Nagesh on 09-Mar-12 04:52 AM

Hide "New" document menu item in document library views

Hi all,

Recently my customer asked me to do something I generally do not approve of - changing the basic behavior of a SharePoint document library.

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 "upload" documents...

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:
function HideNewDocumentMenuItem()
{
try
{
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];
elm.parentElement.parentElement.style.display="none";
elm.parentElement.parentElement.nextSibling.style.display="none";
}
}
}
}
}
catch(e){}
}
D Company replied to Rai Nagesh on 09-Mar-12 05:09 AM
Hello,

I'm not sure that directly u can hide this, u have to develop your own custom template in code that disables this functionality.

the best way is use JQuery.

see this Example

and also look into this fixed thread

Regards
D