Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We are using sharepoint 2007. Anyone knows how to hide or disable New and upload menu from sharepoint document library

share|improve this question

migrated from stackoverflow.com Jun 8 '12 at 14:49

This question came from our site for professional and enthusiast programmers.

3  
ummm??manage it with permissions. What is different in your requirement? –  Shoban Jun 8 '12 at 7:40
    
users will have full control access and to upload fie in document library we have designed the custom upload page so we don't want show the new and upload options to the users. is it possible doing this by coding ? Thanks a lot for taking time to understand the question.. –  Rushikesh Jun 9 '12 at 20:47
    
Are you allowed to use jQuery and javascript on your page? We do this on 2007 because we don't have server access and we also cant use custom actions in 2007. –  spevilgenius Jun 15 '12 at 13:17
    
Yes we can use jquery or javascript.It is allowed –  Rushikesh Jun 18 '12 at 13:28

3 Answers 3

Yes, you can hide/disable buttons using the custom action. See more details http://blogit.create.pt/blogs/andrevala/archive/2008/08/11/SharePoint-2007-Deployment_3A00_-Custom-Action-Features.aspx

share|improve this answer
    
poor option for something that could be achieved out of the box with correct permissions. –  Chris Johnson Jun 19 '12 at 6:47
    
See also the official documentation, How to: Modify the User Interface Using Custom Actions and the feature.xml schema definitions –  Nathan Jul 31 '13 at 0:15

I would expect this to work off the document library permissions if you browse to the real location of the document library. You would need to only allow 'Read' access to this document library for those user who you not wish to upload or create new documents.

You can have some control over the Documents web part which can be pointed to your document library and have its 'Toolbar Type' setting set to 'No Toolbar'. You can divert users to a page with such a web part set up which might give you the desired results.

share|improve this answer
    
I have tried the No Toolbar option but this option removes all four options..we want to hide or disable only New and Upload options of the document library –  Rushikesh Jun 9 '12 at 20:49
    
I think in that case you should just change the permissions on the list. Unless you want to have a go at modifying a copy of the out of the box doc library schema... I'm not sure whether that will allow the level of control that you need. –  Zeb Jun 10 '12 at 12:42

Just give read Permissions to users

Select the Document Library

Goto Setings >Document Library Settings

Select Permissions for this document library under Permissions and Management

Permission page opens with list of all Existing permission.

  • If the set of users is already existing, check on their names and Select Actions > Edit Permissions. Out of the permissions select Read and then OK.
  • If new users are supposed to be given permission, Select New List the users separated by semicolon in the Box. Out of the permissions select Read and then OK.

Add if you want upload through code, use it through Elevated Priviledges

SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                  //Code to upload
                }

Other way is you can hide them through script in a Content Editor Webpart. Then no need of above coding and giving Read permissions.

Script to hide upload and New menu:

<script>
var aTags=document.getElementsByTagName('a');

for(i=0; i < aTags.length; i++)
{

 if(aTags[i].id.indexOf("NewMenu")!=-1)  
  {

   //alert(aTags[i].id);

   aTags[i].parentNode.parentNode.style.display='none';

  }

  if(aTags[i].id.indexOf("UploadMenu")!=-1)
  {

   //alert(aTags[i].id);

   aTags[i].parentNode.parentNode.style.display='none';
   break;
  }
}
</script>
share|improve this answer
    
@SPDoctor : Edited the answer –  Ankita Sen Jun 15 '12 at 12:28
    
That's great, thanks. –  SPDoctor Jun 15 '12 at 18:01
    
Hi Thanks for the answer.. I tried this but one problem like when user with read permission uploads the file in document library it shows System account in Modified By column –  Rushikesh Jun 18 '12 at 13:25
    
@Rushikesh : See updated Answer with Script. –  Ankita Sen Jun 19 '12 at 5:50
    
Hi ankita I have added the script in content editor web part but no success.. :( –  Rushikesh Jun 19 '12 at 12:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.