Monday, May 14, 2018

Create New SharePoint Web coping sibling site content


Scenario

There are situations when you need to create duplicate the already created web using same site template, language and site structure. This article will cover how to use PowerShell to create new web, export sibling site and restore on new web. This process is dissected in three sections,
.

Create New Web

The basic PowerShell command to create web is following,


New-SPWeb -url "http://spsite/en-us/ACCOUNTING" -Name "Asset Accounting" 

If you want to use specific template for new web you can write following command,
New-SPWeb -url "http://spsite/en-us/ACCOUNTING" -Name "Asset Accounting" -Template BLANKINTERNET#2

You can find the installed templates from following command,
Get-SPWebTemplate

If you want to use specific template and specific language for new web, you can write following command,
New-SPWeb -url "http://spsite/en-us/ACCOUNTING" -Name "Asset Accounting" -Template BLANKINTERNET#2 -Language 1033
Note: 1033 is for English which is default. If we need to create this for arabic, use 1025.

Export Sibling Site

Following is command for exporting sibling site

Export-SPWeb "http://spsite/en-us/Finance" -Path "c:\firstbackup.bak" 

Import Backup to New Site

Now we have new site and backup of sibling site. We will now restore that backup to newly created web,

Import-SPWeb "http://spsite/en-us/ACCOUNTING" -Path "c:\financeaccount.bak"