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

3 comments:

Andrés S. Castaño said...

Hi Rohit, do you need create the metadata columns in the target library, or the webservice create them automatically during the copy operation?

Rohit C.M. Sharma said...

Andres, you need to create the columns this web service will just move the data.

Unknown said...

Hi Rohit, Do you have a code sample for this copy of documents into another library? If you can, please sent it to charanrajv@live.com

Post a Comment