Copy version history from one file to another

New Contributor

The following is an existing functionality implemented in SharePoint 2010. Unfortunately, I don't have access to the code. So I'm not sure how the following is achieved.


Is the following achievable in SharePoint online?


  1. First, a file with a specific extension is uploaded into a library. This file gets a SharePoint ID.
  2. Then over that file, there is a custom action to upload another file with a different extension in the same library.
  3. When the user performs the custom action the following happens.
  4. The original file gets backed up to a specific folder in the same library.
  5. The new file gets uploaded with a different SharePoint ID and it gets updated with the version history of the first file.
  6. The first file seems to get deleted.

I had a look at this thread, but that is not helpful.

2 Replies
Similar functionality can be developed in SharePoint Online, but I highly recommend to set a test lab / make a proof of concept before going ahead. Basically this is what you need to developer do:
1. Create a SPFx extension that allows to upload a new file to the library
2. The SPFx extension will have to call SPO REST APIs to first make a copy of the actual file in a folder and then allow to upload the new version of the file without overwriting current one.
3. It may happen SPO REST APIs are not enough and you could need to develop a custom API in Azure (It seems not to be the case for your scenario, but that's why I suggest to test it first)

@Juan Carlos González Martín Thank you and yes this is what I had in mind. But my worry is, since the client script has to copy the metadata details from the old file and has to apply that in the new file for each version entry of the old file, there is a good chance an issue might occur and the new file might have partial version details.