Updating existing files in SP2010 library


  • hi all,

    I would like to help out people in our "document control" department.  We have documents that have metadata (infopanel) in them.  i would like to provide our users with an "update this file" button, so that if a new file comes in, regardless of the filename, will allow them to upload a document that will add a version to the existing document they are updating.

    as it stands, it looks like they must rename the file to the exact file name as it appears in the document library, and i thought this might be a good way to handle it.

    any thoughts on how this can be accomplished would be appreciated.



    Monday, April 22, 2013 5:49 PM

All replies

  • Hi George,

    I’m not very clear about your description, by default, when adding a new file with an existing file in the site, there will be options, ‘Replace existing file’, ‘Save changes with a different name’,’Merge changes into existing file’. When choosing ‘Replace existing file’, it will create new version for the existing file, you can find the old file in version history.

    So, I’m not sure your “Update the file” button, if you mean to add it to the ‘file already exists’ option with ‘Replace existing file, Save changes…’, it seems to be same as the default Replace existing files function.


    Qiao Wei
    TechNet Community Support

    Thursday, April 25, 2013 8:23 AM
  • you are correct, you can rename the file to exact file name with the new file you are uploading, once it is renamed then you can upload the new file, it will overwrite the same item and keep the old file in version history.

    All this you will have to do in a custom code, you will have to build your own command action menu to add new version or update this file. on click of that you need to open a custom browse control in a popup window (custom application page you can display in a popup)

    And then you can write the code to:

    1) Rename the existing selected file with the new file you have browsed

    2) Upload the new file

    We have implemented the same functionality in one DMS project, it works fine, only the think is in version history if the old file was of type doc and new one is pdf then it shows all previous version as pdf, so we have build custom version history popup as well

    Mark this post as answer if this resolves your issue.

    Everything about SQL Server | Experience inside SQL Server -Mohammad Nizamuddin

    Thursday, April 25, 2013 8:49 AM
  • Qiao, what you are talking about is only if the file name is the SAME as the original file in sharepoint.  If the file has a different name, then there is no way for sharepoint to know what to replace.  the problem is the burden of making sure the file name is correct before upload.  i want to take this worry out of the person's hands.



    Thursday, April 25, 2013 2:49 PM
  • Mo, 

    Did you have any issues with versioning other than the different file type (which is what i would expect)?  for example, did you have to itterate through the file versions and re-save them, or was there a simple save file and it automatically updated to a new version via your workflow?

    Another thing i was thinking was a simple vs2010 workflow that contains an initialization form done in infopath (not familiar with writing aspx pages in SP yet) with an attachment button, and when the workflow runs, would extract the file from the xml document to do the update.  seem reasonable?



    Thursday, April 25, 2013 2:58 PM