This should be possible, I have find some examples but with list items, or entire sites, not with only a document library.

Id be happy if somebody can provide working code!!

1 Answer 1


This is a response I posted elsewhere (the links below contain code segments. Export/Import SPWeb works with site, list, or document libraries) -

The quickest way would be to export the site/list/document library using the Export-SPWeb PowerShell command. Use Import-SPWeb for importing the file package (it can also use optional compression. See the -Path and other options in the Export-SPWeb command).

An example showing the use of the above method - Export / Import / Migrate document libraries across sites in SharePoint 2010.

UPDATE: A near-equivalent using C# SPExport/SPImport is given here - Using SPExport and SPImport: Part 1

  • I need c# code not powershell of course!! Commented Mar 21, 2012 at 19:34
  • I have updated the above with a link to a similar example in C# Commented Mar 21, 2012 at 20:56

Your Answer

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

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