Moving Documents from library to library deletes version history, how do you retain it?
Whenever I copy a document from one document library to another, the document moves fine, but all the version history is lost. I have tried moving it using Windows Explorer, using the Send to function from the drop down list on the document in the library, and also saving the library as a template and creating a new one using it. After looking online, it seems that all version history is stored in a virtual directory called _vti_history in the route of the site, and all historic documents are storing by version number, in, what I call, a base-512 numbering system. For example, lets say that the document Im working on is stored: http://portal.sharepoint.com/site123/library123/document123.doc. The historic documents will be stored: http://portal.sharepoint.com/site123/_vti_history/1/library123/document123.doc. The version numbers are as follows: Version Location 0.1 1 0.2 2 0.3 3 1.0 512 2.0 1024 2.5 1029 Etc. etc Now, is there any way to access this virtual directory (Apart from server side) to manually migrate these documents or a simple way on the front end to copy documents and keep the version history? Any help on this will be truly, truly appreciated.Sharepoint Customiser
September 22nd, 2009 2:01pm

Hi, I assume your SharePoint server were MOSS 2007. SharePoint user interface allow you to copy/move documents across sites but the only the latest version of the document. Because the build-in SPFile.MoveTo method merges custom properties that you really dont want. It is by design. In my opinion, the workaround is to copy document and its versions one by one via SharePoint Object Model. We can get the SPFile and the SPFileVersion objects from the original library and add them to another library one by one. After copying a file or version, get the original custom property form the source file or version and use the SPListItem.SystemUpdate(false) method to update the target file or version. This workaround can persist most of the properties except the modified time or modified by field. If you have concern of these two fields, please check the AllUserData table in the content database. However, please understand Microsoft doesnt support the operation that modify data in database directly. For your reference: Copying documents between libraries with metadata - including version history http://www.sharepointblogs.com/dez/archive/2007/11/30/moving-copying-documents-between-libraries-with-metadata-including-version-history.aspx SPListItem.SystemUpdate Method (Microsoft.SharePoint) http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.systemupdate.aspx Important Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. Thanks for your understanding. Rock WangRock Wang MSFT
Free Windows Admin Tool Kit Click here and download it now
September 24th, 2009 5:38am

Thanks Rock Sharepoint Customiser
October 7th, 2009 11:10am

Hi, I am trying moving from one document library to another library with version. but i am not unable move the current version of the file. my document library contains 0.1,0.2,0.3,1.0,1,2,2.0,2.1,3.0,3.1. i am unable to move last version is 3.1. foreach(spfileversion var in spfile.versions) Thank you very much Kumar dinta.kumar@hotmail.com
Free Windows Admin Tool Kit Click here and download it now
February 17th, 2011 7:30am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics