Disable “Overwrite Existing File” In SharePoint 2010


Disable “Overwrite Existing File” In SharePoint 2010


In this post I’m gonna discuss how can we disable Overwrite Existing File check box in document library in SharePoint 2010. I was in situation where my client needs this feature to be applied over site level.

Initially what I did, I modified upload.aspx file, but it messed at farm level and resulted this on all sites available which was not the requirement at all.

I searched a lot on Google but I got solution to my problem in pieces, which was headache trust me. So now I’m writing this post where I’ll share the basic idea how SharePoint works on site level and farm level and how and where changes have to be made.

Before proceeding let me give brief idea how this all works, we have 2 very important files in our SharePoint, that’s Default.master and v4.master pages, when ever we create new site, copy of these files are made locally available for each and very site. If we are making changes directly in these files it will be a modification at farm level and will effect each and every sites, as these are the base files.

Now we come back to our problem, we now have to deal with modification at site level. For this we need to open site in our SharePoint designer. When we open site in SharePoint designer we will see these files i.e. Default.master and v4.master but these are the local files which are available for only that particular file and any changes made to this file will be resulted in that particular site only and not at the farm level.

So I’ll be using jQuery in order to deal with this issue. Follow below mentions steps:

  • Open your site in SharePoint Designer
  • Navigate to Master Page from the list available in left sidebar.
  • You will see 3 master page(s), i.e. Default.master, minimal.master, and v4.master page.
  • Open v4.master page.
  • Add below jQuery Code under head tag.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    <script type="text/javascript">
    var form = $('form');
        var checkbox = $('#ctl00_PlaceHolderMain_ctl01_ctl05_OverwriteSingle');
        var multiple = $('#ctl00_PlaceHolderMain_UploadDocumentSection_ctl03_UploadMultipleLink');

See below screen shot for reference.









And I was able to deal with the Overwrite Existing File check box at site level using jQuery.









If you find this article helpful, please share.

JavaScript, ASP.Net & PHP Web Developer. Connect with me on Facebook and Twitter.

Share This Post

Related Articles

Powered by Paras Babbar · Designed by Paras Babbar