I’ve had to perform this task several occasions now. Because I don’t do it very frequently I found myself looking up the commands and trying them several times until I had them working. This post now records the correct commands.
I have a Tasks list that I want to copy from one site to another. The list is names Tasks. I want to move it from the Operations site to the Sales and Marketing site. Respectively /Operations/Tasks">http://<serverName>/Operations/Tasks to /Sales">http://<serverName>/Sales and Marketing/Tasks.
Command to export site to cmp file:
Export-SPWeb -Identity <SiteURL> -Path <Path and File Name> [-ItemUrl <URL of Site, List, or Library>] [-IncludeUserSecurity] [-IncludeVersions] [-NoFileCompression] [-GradualDelete] [-Verbose]
The actual command in this scenario is:
export-spweb -identity http://<serverName>/operations -path c:tasklist.cmp -itemurl /operations/lists/tasks –includeusersecurity
Command to Import Task list to new site
Import-SPWeb -Identity <SiteURL> -Path <ExportFileName> [-Force] [-NoFileCompression] [-Verbose]
Import-SPWeb -identity "http://<serverName/sales and marketing" -path c:tasklist.cmp –force
There you have it!