2

How can I programmatically move a document from one document library to another while preserving metadata? Preferably using the server OM.

3 Answers 3

1

I don't have the source code handy but the SPListItem.Copy() method would probably be a good place to start - http://msdn.microsoft.com/en-us/library/ms455492.aspx.

1

There is SPFile.MoveTo() method which moves the file within the same site: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.moveto.aspx

0

I know you have expressed an interest in using the server object model, but there is also the Copy.asmx web service (specifically the CopyIntoItems() method). I, myself, don't like the Copy web service, because it creates a link back to the original document. I just wanted to provide another alternative.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.