Tuesday, September 20, 2011

SharePoint 2010 SPList Backup and Restore

In SharePoint 2010 it's very easy to backup and restore a Site Collection, a Site, or a List. For example if want to backup a SPList, just go to Central Admin => Backup and Restore => Export a site or list, select the List, type the backup file name then click the "Start Export" button and all done. Alternatively we can use powershell to do the same job:
Export-SPWeb -Identity "https://portal.intranet.com/department/it" 
             -ItemUrl "/department/it/Lists/Projects" 
             -Path c:\backup\ITProjectsList.cmp
             -IncludeUserSecurity
To restore the List run the script:
Import-SPWeb -Identity "https://backup.intranet.com/department/it"
             -Path c:\backup\ITProjectsList.cmp
             -IncludeUserSecurity 
             -Force
Be aware that the backup could result in multiple files depending on the SPList size and the machine's setting. If that's the case and you miss any backup file with .cmp extension, you will get following error when run the Import-SPWeb command:
Import-SPWeb: Could not find file 'C:\Users\{user}\AppData\Local\Temp\{guid}\ExportSettings.xml'...
Simply copying all the backup files to the restore location would resolve the problem.