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!!


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!! Mar 21 '12 at 19:34
  • I have updated the above with a link to a similar example in C# Mar 21 '12 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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