Microsoft Modern workplace recommends flat SharePoint structure. Every site should be a site collection in Modern SharePoint experience. Most of the organizations are using a standard site template with custom pages & branding for Site Collections. It is being observed many business users are looking for existing site template to be used on their new site collections. So, it is a common challenge to provision modern site collections from an existing site collection by following Microsoft recommended process.
In this blog I’ll discuss how to create site collections from existing site collections in different ways. I have also mentioned which processes are supported by Microsoft for creating Modern site collections.
Create Modern Site Collections using Site Design from existing one(supported by Microsoft for Modern SharePoint Online Sites)
Microsoft recommends to automate provisioning new or existing modern SharePoint sites using site designs. You need to create site designs to provide reusable lists, themes, branding, regional settings, and external sharing etc.
Before proceeding, I just wanted to bring to your attention – site design will not copy any site assets or custom pages to the new site collections. Site design has the limitations to copy custom pages from an existing site collection to new modern site collection.
Let’s proceed with the site design steps –
i. Connect to SharePoint Online using SharePoint Online Management PowerShell.
Connect-SPOService -Url https://yourtenant-admin.sharepoint.com -Credential admin@ yourtenant.onmicrosoft.com.
ii. Get site script from existing site.
$extracted = Get-SPOSiteScriptFromWeb ` -WebUrl $siteUrl ` -IncludeBranding ` -IncludeTheme ` -IncludeRegionalSettings ` -IncludeSiteExternalSharingCapability ` -IncludeLinksToExportedItems ` -IncludedLists ("SiteAssets", "SitePages", "Lists/Events")
Or you can use the below PowerShell to get the json output and save it to a Json File.
Get-SPOSiteScriptFromWeb –WebUrl $siteUrl -IncludeTheme -IncludeBranding -IncludeSiteExternalSharingCapability –IncludeRegionalSettings -IncludeLinksToExportedItems -IncludedLists ("SiteAssets", "SitePages", "Lists/Events")
iii. Add the site Script.
- Title “Onboarding Team site” `
- Description “This is a copy of Onboarding site collection.” `
- Content $extracted
Or you can use the below PowerShell to add the site script from a Json file from local folder.
Get-Content 'D:\Site Design\SiteScript.json'-Raw | Add-SPOSiteScript -Title "Onboarding Team site"
Once you run the above script, you will get a GUID which needs to use in Site Design script.
iv. Add the site design.
Add-SPOSiteDesign -Title ” Onboarding Team Site” -WebTemplate “64” -SiteScripts “ebbfe51f-7300-49ff-81f1-c36243e5e970” -Description “Creates a new Team Site from Onboarding template”
The -WebTemplate value selects which base template to associate with. The value “64” indicates Team site template, and the value “68” indicates the Communication site template.
Now use the site design on your New site collections –
Go to SharePoint Admin Center -> Create -> Select Team Site or Communication Site – > Choose Design.
Here will see the “Onboarding Team site” is available on the drop down. Choose the design and provide the necessary info. Your site collection will be ready with the site design.
You can also apply a published site design to an existing site collection using the Invoke-SPOSiteDesign cmdlet.
Expectations from site design:
- Update branding
- Set theme
- Set site external sharing capability
- Update site regional settings
- Create or update list structure
Ref. Article – https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/get-started-create-site-design
Create Modern Site Collections using PnP Provisioning Template from existing one (Not supported by Microsoft Premier support team)
You can use PNP Provisioning template to create a new site collection from an existing site collection with all branding & custom pages. I believe this process will meet most of your requirement to clone any modern site collection with custom pages & branding.
Let’s have a look on the PnP commands.
Install the PnP module first if it is not present on your computer.
- Connect to site collection from which one you want to clone.
- Connect-PnPOnline -PnPManagementShell -Url https://tenantname.sharepoint.com/sites/SCT
- Get the provisioning template e and store it to local folder “D:\PNP\SCtemplate.xml”
- Get-PnPProvisioningTemplate -out “D:\PNP\SCtemplate.xml” -PersistBrandingFiles -PersistPublishingFiles -IncludeNativePublishingFiles -IncludeHiddenLists -IncludeAllClientSidePages
- Create a new site collection with appropriate template.
- Create the new site collection from SharePoint Admin center with matching site collections from Source site template.
- Connect to site collection from which one you want to clone.
- Connect-PnPOnline -PnPManagementShell -Url https://tenantname.sharepoint.com/sites/MDS
- Apply the provisioning template to the target site collection.
Apply-PnPProvisioningTemplate -Path “D:\PNP\finaltemplate.xml” -ResourceFolder “D:\PNP\” -ClearNavigation
Ref Article – https://docs.microsoft.com/en-us/sharepoint/dev/community/community#whats-the-supportability-statement-around-pnp-open-source-components-and-solutions
Duplicate Modern site collection using Sharegate Desktop
Sharegate Desktop is being used widely for SharePoint migration. If you are using the Sharegate Desktop in your organization, you can get advantage from this tool for duplicating site collections by copying all custom pages, branding theme, site assets etc. to the destination site collections. This process is more efficient compared to all three for creating multiple site collections from an existing site collection. However, for this you should have Sharegate Desktop license.
- Open the Sharegate Desktop Tool.
- Click on Explorer under Environment from left Nav.
- Provide the source site collection URL on the search box and click search.
- Select the site you want to duplicate.
- click Duplicate Site Collection in the quick actions panel.
- Provide the necessary details for the new site collection – Title, Description, URL, Site collection administrator etc.
- Click Duplicate
- The task will now run.
- You can access the results anytime through Tasks.
- For more information on the results, see Results.
Your new site collection will be ready within few minutes. The new site will be ready with all custom pages and branding.
Ref Article – https://support-desktop.sharegate.com/hc/en-us/articles/115004859227-Duplicate-Site-Collection
Create New Site Collections using Save as Template from existing one (supported by Microsoft for SharePoint Online Classic Sites Only)
This process is an old school feature for creating site collection from template. However, this feature is only supported for Classic sites. There are some issues observed for feature activation like publishing feature on the modern site created from Classic template. You can use this feature if you are creating classic sites from template. Open the source site collection which site template want to use.
- Create Template – Save the site as template by opening the URL – “Site URL” + “/_layouts/savetmpl.aspx” without selection “Include Content”. The template will be created without content and saved to Solution gallery.
- Download Template – Now go to solution gallery and download the template by opening the site URL + “/_catalogs/solutions/Forms/AllItems.aspx” or Site Settings -> Solutions. Click on the solution and download the solution save it local folder.
- Create Site Collection with Blank template – Go to SharePoint Admin portal. Click -> Create -> Other Options -> More Templates. Provide the below necessary information and select the template under Custom tab. Click Ok. Once the site is created, the site will ask for template to use.
- Upload the custom template to new site collection solution gallery & activate – Open the new site solution gallery by the URL – “Site URL” + “/_catalogs/solutions/Forms/AllItems.aspx”. Upload the custom template from the local computer which downloaded earlier. Activate the solution after upload. Select the solution and click on Activate from top ribbon.
- Apply the custom template to New site – Open the new site and select the template “NEWTemplate” from the custom tab. The site will be ready after applying the template.
Note: Though you can create modern site collections using this process, but Microsoft is not recommending for SharePoint Online (Modern Sites).
Ref URL – https://docs.microsoft.com/en-us/sharepoint/dev/general-development/save-download-and-upload-a-sharepoint-site-as-a-template