Export and Import Subsite in SharePoint 2013 using PowerShell

Export-Import subsite using PowerShell in SharePoint 2010
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 used to export a sub site, list or document library.

Open SharePoint 2013 Management Shell and run this command. Change Site URL and Path values accordingly.
Export-SPWeb "http://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 "Export a site or list" link under "Granular Backup" group.
Export subsite sharepoint 2013 powershell
Important: Both the source and destination sites should be using same template!

Import subsite in SharePoint 2013 using PowerShell
Import-SPWeb PowerShell cmdlet used to import a sub site from backup.
Import-SPWeb "http://sharepoint.company.com/sites/Sales/US/" ` 
        -Path "C:\sales-us.cmp"  -includeusersecurity -UpdateVersions overwrite 
With these cmdlets, we can Export and Import a particular sub site, list or document library. You can also use Export-SPWeb & Import-SPWeb cmdlets to copy list with data between SharePoint Sites/Web Apps/or between different environments. E.g. Copy a SharePoint list from Dev to Staging server.

Please note, export-import is not as 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.

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.