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>

Wednesday, 27 June 2012


Adding Columns to a Provisioned List



You can use the SharePoint Foundation object model to programmatically add columns to provisioned lists.

To add a column to a provisioned list

  1. Use the Fields property to access the collection of list columns on the specified list. This method returns anSPFieldCollection object.
  2. Use one of the following methods of the returned SPFieldCollection object to add a new column to the list: