Copy version history from one file to another

%3CLINGO-SUB%20id%3D%22lingo-sub-1893102%22%20slang%3D%22en-US%22%3ECopy%20version%20history%20from%20one%20file%20to%20another%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1893102%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20following%20is%20an%20existing%20functionality%20implemented%20in%20SharePoint%202010.%20Unfortunately%2C%20I%20don't%20have%20access%20to%20the%20code.%20So%20I'm%20not%20sure%20how%20the%20following%20is%20achieved.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20the%20following%20achievable%20in%20SharePoint%20online%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3COL%3E%3CLI%3EFirst%2C%20a%20file%20with%20a%20specific%20extension%20is%20uploaded%20into%20a%20library.%20This%20file%20gets%20a%20SharePoint%20ID.%3C%2FLI%3E%3CLI%3EThen%20over%20that%20file%2C%20there%20is%20a%20custom%20action%20to%20upload%20another%20file%20with%20a%20different%20extension%20in%20the%20same%20library.%3C%2FLI%3E%3CLI%3EWhen%20the%20user%20performs%20the%20custom%20action%20the%20following%20happens.%3C%2FLI%3E%3CLI%3EThe%20original%20file%20gets%20backed%20up%20to%20a%20specific%20folder%20in%20the%20same%20library.%3C%2FLI%3E%3CLI%3EThe%20new%20file%20gets%20uploaded%20with%20a%20different%20SharePoint%20ID%20and%20it%20gets%20updated%20with%20the%20version%20history%20of%20the%20first%20file.%3C%2FLI%3E%3CLI%3EThe%20first%20file%20seems%20to%20get%20deleted.%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%3CSPAN%3EI%20had%20a%20look%20at%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fsharepoint.stackexchange.com%2Fquestions%2F195795%2Fcopy-major-version-of-document-to-another-library-preserve-document-history%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ethis%3C%2FA%3E%3CSPAN%3E%26nbsp%3Bthread%2C%20but%20that%20is%20not%20helpful.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1893102%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E2010%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1893507%22%20slang%3D%22en-US%22%3ERe%3A%20Copy%20version%20history%20from%20one%20file%20to%20another%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1893507%22%20slang%3D%22en-US%22%3ESimilar%20functionality%20can%20be%20developed%20in%20SharePoint%20Online%2C%20but%20I%20highly%20recommend%20to%20set%20a%20test%20lab%20%2F%20make%20a%20proof%20of%20concept%20before%20going%20ahead.%20Basically%20this%20is%20what%20you%20need%20to%20developer%20do%3A%3CBR%20%2F%3E1.%20Create%20a%20SPFx%20extension%20that%20allows%20to%20upload%20a%20new%20file%20to%20the%20library%3CBR%20%2F%3E2.%20The%20SPFx%20extension%20will%20have%20to%20call%20SPO%20REST%20APIs%20to%20first%20make%20a%20copy%20of%20the%20actual%20file%20in%20a%20folder%20and%20then%20allow%20to%20upload%20the%20new%20version%20of%20the%20file%20without%20overwriting%20current%20one.%3CBR%20%2F%3E3.%20It%20may%20happen%20SPO%20REST%20APIs%20are%20not%20enough%20and%20you%20could%20need%20to%20develop%20a%20custom%20API%20in%20Azure%20(It%20seems%20not%20to%20be%20the%20case%20for%20your%20scenario%2C%20but%20that's%20why%20I%20suggest%20to%20test%20it%20first)%3C%2FLINGO-BODY%3E
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.