Monday 9 July 2012

How to bypass Edit Properties Page while uploading documents in a document library



Skip edititem.aspx while uploading documents to document library in sharepoint
or
How to bypass Edit Properties Page while uploading documents in a document library

 

Simply add this to your edititem.aspx below the placeholdermain



<script type="text/javascript">
    _spBodyOnLoadFunctionNames.push("Redirect");
    function Redirect()
    {
       var mode = getURLParam('Mode');    
      /*  var sourceURL = getURLParam('Source');      
       var  properSourceURL = replaceCharacters(sourceURL);    */
       if (mode == "Upload")
     window.frameElement.commonModalDialogClose(1, 'saved');
              /* window.location = properSourceURL;*/
             
}
 
    function getURLParam(name)
{
 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
 var regexS = "[\\?&]"+name+"=([^&#]*)";
 var regex = new RegExp( regexS );
 var results = regex.exec( window.location.href );
 if( results == null )
   return "";
 else
   return results[1];
}

function replaceCharacters(str)
{
  str = str.replace(/%20/g, " ");
  str = str.replace(/%2F/g, "/");
  str = str.replace(/%3A/g, ":");
  str = str.replace(/%2E/g, ".");
  return str;
}

</script>

2 comments: