Friday, March 23, 2012

Coping documents between libraries preserving the metadata


I faced a requirements in SharePoint 2007 where the documents need to be copied from one document library to another  document library in a different site (in different farm too) and the metadata of documents was also required to be preserved. I was able to do it using the Copy Web Service the GetItem Method generate a byte array representation of document and it also copied all the metadata in an array of FieldInformation object which can then be passes to CopyIntoItems method to upload the document in the destination document library.

I hope this would help other people finding the simple method of copying documents with metadata.

Cheers,
Rohit Sharma