Export-Import subsite using PowerShell in SharePoint 2013/2016
How to export SharePoint subsite? Export subsite SharePoint 2013 PowerShell, Unlike SharePoint 2013, you’ll have to create a subsite first and then import. Export-SPWeb cmdlet is used to export a subsite, list, or document library.
Open SharePoint 2013 Management Shell and run this command. Change Site URL and Path values accordingly.
Export-SPWeb "https://sharepoint.company.com/sites/Sales/US/" ` -Path "C:\sales-us.cmp" -IncludeVersions All -includeusersecurity
To export a site, list, or document library by using Central Administration:
You can also export a Subsite from SharePoint 2010/2013/2016 Central Administration via “Export a site or list” capability. Go to SharePoint Central Administration >> Backup and Restore >> Click on the “Export a site or list” link under the “Granular Backup” group.
Important: Both the source and destination sites should be using the same template!
Import subsite in SharePoint 2013 using PowerShell
Import-SPWeb PowerShell cmdlet is used to import a sub-site from backup.
Import-SPWeb "https://sharepoint.company.com/sites/Sales/US/" ` -Path "C:\sales-us.cmp" -includeusersecurity -UpdateVersions overwrite
With these cmdlets, we can Export and Import a particular subsite, list, or document library. You can also use Export-SPWeb & Import-SPWeb cmdlets to copy the list with data between SharePoint Sites/Web Apps/or between different environments. For E.g. Copy a SharePoint list from Dev to a staging server.
Please note, export-import is not the same as backup-restore. Certain artifacts will not be copied during export-import. Such as:
- Workflow association-data
- Audit logs
- Recycle bin items
- Created By, Modified By details, etc.