Showing posts with label Disabling the Upload button of a Document library in SharePoint 2010 or in sharepoint 2007. Show all posts
Showing posts with label Disabling the Upload button of a Document library in SharePoint 2010 or in sharepoint 2007. Show all posts

Tuesday, August 7, 2012

Disable the Upload Button of a Document library in SharePoint 2010

Disable the "Upload" button of a Document library in SharePoint 2010

There are two ways to disable the upload button :

1st way :

Open your site using SharePoint Designer.  Once opened, navigate to your Library and edit your default view.  (All Files -> Your Library -> Forms -> Your View.aspx, right click and select Edit File in Advanced Mode)

At the bottom of the screen you will see three options Design, Split, and Code.  Select the Split option.

In your code window, locate the <asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>  tag.
Now, scroll down and find the closing </asp:Content> tag.  Insert a line above the closing tag.  Place the following code into that newly created blank line.

<style type="text/css">
 #Ribbon\.Documents\.New\.AddDocument-Large
{
display:none;
#Ribbon\.Library\.Actions\.OpenWithExplorer-Medium
{
display:none;
}
</style>

Click save, then refresh your page.  The Documents tab should now be missing the Upload Document button and the Library tab should be missing the Open with Explorer button.

Using IE, you can find the ID’s of the other buttons in the ribbon.  With your View open in IE, click F12.  Once Developer Tools finishes loading, select Find from the top menu, then click on Select Element by Click.  Back in IE, click on the button you want the ID of.

2nd Way :


I would like to show this by giving an example :-

Suppose i have a document library that uses Infopath form it is termed as Form Library.

When a new form is submitted , a series of workflows are triggered and corresponding task is assigned , etc. I had an issue where workflows were getting started multiple times and the task are also assigned  , and generally causing chaos.

I traced the issue, that users were not using the "New Document" button to create a form,but were also saving old forms and re-uploading them using the "Upload" button which results in duplicate files and duplicate workflows etc.

I resolved the issue by simply removing the upload button from the edit.aspx page in each library using the SharePoint Designer.

Steps to do so :

1. Click on the SharePoint Designer to open the edit.aspx page.

2. In Design view right click the List View Web part and select the XSLT data View from the context menu.

3. Switch to split view and locate the "New" button, and you will see the XSLT code.

4. Set the "td " visibility as "hidden" as shown below :








In order, to prevent an unsightly 'blank space' in the menu, I moved the location of the hidden button to the last button on the right of the menu. 

Now users have to use the "New" button to create a new document and cannot use the upload button.
Keep in mind that you'll have to do this for each view that the users have access to, as each view has it's own page that will need editing. 
Thanks

Any Question/Suggestion ??