Copying documents between SharePoint libraries keeping version history (part 1)
Currently working on a SharePoint project which has a requirement to copy and move documents from one library to another. No problem, I said. Keep the version history as well, they said. Fine, I said. And then I set about it, thinking everything would just happen automatically when you move documents.
Except it doesn’t. Moving, or copying documents from one library to another seems to cause SharePoint to lose any version history, so the document gets checked in at version 0.1 (or version 1.0 if you’ve only got major versioning set). So when I’d finally regained consciousness and come to terms with what I believe is a major flaw in the product (isn’t version history supposed to be a big part of its document management capabilities?!?!?!) I decided to park this particular issue and do something else……
Unfortunately it is a pressing requirement, so I have returned to try and find a solution. I feel I should point out at this stage that this is all part of a beautifully crafted K2 workflow solution, so I have to fit the solution in with that. And with some help from your friend and mine, Google, I quickly found I wasn’t the only person facing this problem. I found this post by ‘dink’ a useful starting point, and it gives some background on how SharePoint handles its versions.
I have started my solution based on the code example given, but need to tidy it up tomorrow, and will report back in due course. I think there are some optimisations to be made (such as handling the version number doesn’t need to be so protracted), but as I say I will post some of my code later.