Monday, September 26, 2016

SharePoint 2013: How to move a website

Introduction

This posting documents the typical steps for moving a website, or "web" in Microsoft terminology, to a new location, whether in the same web application or a different web application.  The website here is a subwebsite to an existing website or to the root site collection website.  The focus will be on using PowerShell.  The general steps are: 1) identify the web template of the source website; 2) export the website; 3) create a new blank website at the destination having the same web template; and 4) import the source website over the destination blank website.

Procedure

  1. Note down the core URL of the website you want to move.
  2. As a farm administrator, log into any SharePoint server of the farm containing the website you want to move.
  3. Launch an elevated SharePoint Management Shell.
  4. Execute the following commandlets to identify the source website's web template:
    $web=Get-Spweb -Identity "[website core url]"
    $Web.WebTemplate
    $web.WebTemplateId
  5. Note down the WebTemplate and the WebTemplateId that are returned. Combine these using the number symbol "#".  For example, if the WebTemplate returned was "STS" and the WebTemplateID returned was "1", combine these as "STS#1".
  6. Execute the following commandlet to export the source website, including all versions and its security configurations:
    Export-SPWeb -Identity "[website core url]" -Path "[eg D:\MyExportFolder\MyWebExport.cmp]" -IncludeVersions "All" -IncludeUserSecurity -CompressionSize 1000 -Force
  7. If moving to a new farm, log into any SharePoint server on the destination farm, and then copy the export file to this server.  Otherwise remain logged into the current SharePoint server.
  8. Execute the following commandlet to create a new website using the same web template that you found earlier:
    New-SPWeb -Identity "[Core URL of the new website]" -Template "[SourceWebTemplate]" -Name "[title of new website]"
  9. Now execute this commandlet to import the exported website:
    Import-SPWeb -Identity "[new website URL]" -Path "D:\][pathtoyourfile]\[exportfilename].cmp"
  10. You're done.  Note that the only user to this website will be you; and the usual user groups (Visitors, Contributors, etc) have not yet been created.

References

Notes

  • The "-CompressionSize 1000" parameter helps ensure that the export will comprise a single file.  The number "1000" is in MB.

No comments: