When we move or copy the file we include properties as well as versions with Createdy, ModifiedBy, TimeCreated and TimeLastModified. Everything works fine except for one issue.
When we publish a document using SPFile.Publish() the ModifiedBy and TimeLastModified are changed - therefore we lose the version history.
Instead we try to fix the issue using the comment field - somehow it solves part of the issue but we would appreciate a better solution.
We have tried changing
oFile.Publish([comment])
to
oFile.Item.ModerationInformation.Status = SPModerationInformation.Approved
oFile.Item.ModerationInformation.Comment = [comment]
oFile.Item.SystemUpdate(false)
but unfortunately ModerationInformation is not available on the SPFile object.
This blog mention the same issue - without a solution. Ideas appreciated.As our last resort we're currently investigating creating a stored procedure which modified the SharePoint SQL database behind the scene. We would prefer not using this solution (albeit it works).