SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 3 down vote accepted

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

share|improve this answer
I need c# code not powershell of course!! – Esteban V Mar 21 '12 at 19:34
I have updated the above with a link to a similar example in C# – Supriyo SB Chatterjee Mar 21 '12 at 20:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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