Copy site with content to another site collection
-
04-10-2020 - |
Question
Are there any SharePoint tools out there that copy all of the content from one site collection to another?
We need to get one site from our site collection and all of the lists and libraries and all of the items on those lists to an entirely new site collection. Are there any good tools out there for this? We also thought a PowerShell script could be viable, does that seem like it may work?
Thank you for your help.
Solution
Using PowerShell, you can always use the command Backup-SPSite to take a backup and then restore it to an empty site collectiong using Restore-SPSite.
Backup-SPSite http://server_name/sites/old_site -Path C:\Backup\site_name.bak
One important thing is that the site collection backup and the new site collection need to be based on the same template. If you are unsure which template the site collection you wanna move are using, you can get the information from PowerShell to.
$web = Get-SPWeb http://server_name/sites/old_site
$web.WebTemplate + " " + $web.WebTemplateId
$web.close()
Then you need to create a new site collection based on the same template from the one you wanna move. When it's done, use Restore-SPSite.
Restore-SPSite http://server_name/sites/new_site -Path C:\Backup\site_name.bak
OTHER TIPS
In order to move the subsites from one site collection to another site collection, their are couple of ways.
Method # 1
- Save the list as template with content.
- create new subsite using that template.
Method # 2
use export-spweb
export-spweb -identity http://www.whsmith.co.uk/Books -path \serversharebackupWHBooksSiteBackup.cmp
Then run Import-spweb
import-spweb -identity http://www.sharepoint.inf4web.com/Books -path \serversharebackupWHBooksSiteBackup.cmp
Note: To use import or export subsite command in power shall both source and destination template should be same.
For SharePoint Online - the way to do this is via PnP :-
Get-PnPProvisioningTemplate -Url -Out to get the provisioning Template
Apply-PnPProvisioningTemplate -Path to Apply the template to the new site / Site Collection
This will get all of the site columns, site content types, term store, list definitions, (empty) lists, Site Structure and copy them to the new site.
If you want content moved across as well, then that needs more PowerShell, but is doable.