Skip to main content

Site Provisioning in SharePoint Online Step-By-Step Guide

Introduction: Site Provisioning Or Site Templating is a developer-friendly feature of SharePoint, using Site Templating SharePoint Allows you to create a replica of its Site Collection and can use to create the same for the departmental sites or the other sites.

It is easy to create and smooth to apply, requiring a single-time operation. It has some pre-requisite to use it

1. Knowledge of PowerShell Scripts.

2. Knowledge of PnP Module.

3. Must have SharePoint Online Administrator credential.

Please follow bellow steps.

Step 1: Open PowerShell in the Administrator mode


Step- 2 Run the below commands, it will install the PnP module.

Install-Module -Name "PnP.PowerShell"

Step- 3 Run the below command in PowerShell

Connect-SPOService -Url https://rb500-admin.sharepoint.com

 After running the above command, it will show you the Login Promote. So, you must put your SharePoint admin credentials, for more details refer to the below screen.

Once you enter the correct credentials, it will be ready for the next step, refer screen below.


Step-4: Run the below commands, these commands specify the list or document library which you want to provision in your template, please copy, paste it and run.

Get-SPOSiteScriptFromWeb -WebUrl "https://test.sharepoint.com/sites/mysite" -IncludeTheme -IncludeBranding -IncludeSiteExternalSharingCapability -IncludeRegionalSettings -IncludeLinksToExportedItems -IncludedLists ("SiteAssets", "SitePages", "Lists/Tools", "Lists/Tips", "Lists/Quick Links List", "Lists/Highlights", "Lists/Footer Links", "Lists/Alerts", "Lists/Company News", "Lists/Article News", "Lists/Dashboard")

 

Step-5:

Copy the output generated by the step 4 command and create a new JSON file with the name myProvisioning.json, please refer below screen you must copy content from step 4 till the bottom of the JSON.

Please skip the last line, refer to the below screen

Step 6 - Connect PnP by running the below commands

Connect-PnPOnline -Url "https://test.sharepoint.com/sites/mytest" -Interactive

 Once you paste it, it will ask for the user credentials, please enter your credentials here Then you will get, the below screen


Step 7 - Run the below command

Get-PnPApp 

Once you run the above command it will give you the list of apps installed on your tenant, refer to the below screen.

Now what you need to do, you must copy the title id (component id) from here, which you want to provision on your template.

Step 8 – Copy the component Id and paste it below the format

{

                "verb": "installSolution",

                "id": "Put web part id from solution in manifest file or get the web part id from PowerShell Command"

}

For example, We are taking three component Id from here to the provision in the template

For that, I copied three Id’s component and pasted them below in this manner

{

                "verb": "installSolution",

                "id": "10688609-079b-4b54-aeab-9768be2d7984"

},

{

                "verb": "installSolution",

                "id": "15368b1d-9ebb-4a94-9920-c57893795441"

},

{

                "verb": "installSolution",

                "id": "26b0d083-c2a1-4eb7-a070-97c985f0cc6d"

Once you pasted it in the above format, you must copy it and paste to the end of the myProvisioning.json file. 

For Example:

Step 9 – Now run the below command,

Get-Content "D:\PowerShell Scripts\myProvisioning.json" -Raw | Add-SPOSiteScript -Title "MySiteHomeSiteTemplate"

 Once you run the above command It will show you the below output


Step 10: Now copy the Id from the above output

ID: c3eb7cce-9af2-468c-973b-69c40b0833a8

Step 11:  Run the below command

Add-SPOSiteDesign

It will ask some questions, please provide it will ask Title, Web Template, and SiteScripts[0]


Note: -

Title - put the template name which you desired

WebTemplate - 64 code is team site template code and if you want to convert into communication use this 68

SiteScript[0] - Paste the id from generate by step 9 command (If you want to add multiple scripts so enter and add more script id and want to skip other than press enter key)

It is done. 

Now it’s time to apply it to existing site or the new site 

Step 1 –

Hope you have a new site, now you need to click on the gear icon, at the top of the header and select Site Template, refer to the below screen


 Once you select it you got the below option, now you need to select it.


It will ask you to install the list of components like the below screen

Once you click it, it will take some time to apply

Note: It will not contain the data which are in the original list.

Attached is the JSON file for your reference


How to delete the existing template, execute the below command with the specific ID

Remove-SPOSiteDesign <ID>
Remove-SPOSiteDesign 21209d88-38de-4844-9823-f1f600a1179a 

Thanks for referring It.

 



Comments

Popular posts from this blog

Power Apps modern driven app Interview Question and answer

Question 1: What is a Power Apps modern driven app? Answer: A Power Apps modern driven app is a low-code/no-code application development platform provided by Microsoft. It allows users to create custom applications that can run on various devices and platforms without the need for extensive coding. These apps can be built using a visual interface and can integrate with different data sources. Question 2: What are the key components of a Power Apps modern driven app? Answer: The key components of a Power Apps modern driven app are: Screens : Screens serve as the user interface for the app and can include multiple layouts, controls, and data visualizations. Data sources : These are the various repositories where the app can retrieve and store data, such as SharePoint lists, SQL databases, Excel files, etc. Connectors : Connectors enable integration with external services and systems, allowing data to be fetched or updated. Formulas : Power Apps uses a formula language called Power Apps

Interview Questions of SPFx SharePoint

What is SPFx? The SharePoint Framework (SPFx) is a web part model that provides full support for client-side SharePoint development, it is easy to integrate with SharePoint data, and extend Microsoft Teams. With the SharePoint Framework, you can use modern web technologies and tools in your preferred development environment to build productive experiences and apps that are responsive and mobile-ready. Scenario Based asking Scenario 1: Scenario: Your team is developing a SharePoint Framework (SPFx) web part that needs to retrieve data from an external API and display it on a SharePoint site. The API requires authentication using OAuth 2.0. The web part should also allow users to refresh the data manually. Question 1: How would you approach implementing this functionality in an SPFx web

SPFX Interview question for 2023

SPFx Interview Questions for 2023 Question 1: What is SharePoint Framework (SPFx)? Answer: SharePoint Framework (SPFx) is a development model introduced by Microsoft for creating client-side web parts and extensions for SharePoint Online and SharePoint 2019. It is based on modern web technologies like JavaScript, TypeScript, and React, providing a rich and responsive user experience. Question 2: What are the key advantages of using SPFx for SharePoint development? Answer: SPFx offers several advantages, such as: Responsive and mobile-ready web parts and extensions. Seamless integration with SharePoint data and services. Support for modern web development practices and tools. Easy deployment and hosting options. Enhanced security and isolation through the SharePoint app model. Question 3: Can you explain the structure of an SPFx solution? Answer: An SPFx solution consists of the following key components: Web Parts: These are the building blocks of SPFx solutions, representing the vi