Override SharePoint OOTB Upload.aspx default for « Add as a new version to existing files » checkbox

With Sharepoint, when we want to upload a file, the « Add as a new version to existing file » is checked by default, and that could be an issue for you.

sharepoint_upload_file

Here is a JavaScript fix to add into your masterpage, just before the </head> tag :

<script type="text/javascript">
function DefaultUploadOverwriteOff() {
  if (document.title.indexOf("Upload Document") > -1) {
    var input=document.querySelectorAll("input");
    for (var i=input.length; i--;) {
      if (input[i].id.search(/\_OverwriteSingle$|\_OverwriteMultiple$/) > -1) input[i].checked=false
    }
  } 
}
_spBodyOnLoadFunctionNames.push('DefaultUploadOverwriteOff');
</script>
</head>

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

*