How to create a SharePoint site template that includes files, homepage, and Planner?

Mohamed Ibrahim 0 Reputation points
2025-08-05T19:21:12.3866667+00:00

Hello,

I want to create a SharePoint Online site template that allows me to deploy new sites with the same structure and content as an existing site.

My requirements are:

  1. The new site should include all files and folders from the source site’s document libraries.
  2. The template should replicate the homepage (modern page layout, web parts, and branding).
  3. When I create a new site from this template, it should also create a Planner plan automatically (linked to the site’s Microsoft 365 group).
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Kai-L 1,155 Reputation points Microsoft External Staff Moderator
    2025-08-05T20:41:19.15+00:00

    Dear @Mohamed Ibrahim,

    Thank you for reaching out to the Microsoft Q&A Community.

    I understand you want to create a SharePoint Online site template that includes files, a specific homepage layout, and an automatically provisioned Planner plan. This is a great requirement for standardizing workspaces across your organization.

    It's important to know that the traditional "Save site as template" feature in SharePoint Online (which you might be familiar with from classic SharePoint) does not fully support modern sites, modern page layouts, or associated Microsoft 365 group services like Planner. This is a legacy feature that does not reliably capture these modern elements or content.

    To achieve your requirements for modern SharePoint Online sites, you'll need to use a combination of modern provisioning tools, primarily SharePoint Site Designs and Site Scripts, often supplemented by PnP PowerShell/CLI or Microsoft Power Automate.

    Here's how you can approach this:

    • Site Design: A pre-defined set of actions (defined in Site Scripts) that are applied when a new site is created. Users can select a Site Design when creating a new site.
    • Site Script: A JSON file that defines the specific actions to be performed on a site (e.g., creating lists, adding columns, applying themes, creating pages, adding web parts).

    Addressing Your Requirements:

     

    1.Include All Files and Folders from Document Libraries

    SharePoint templates (Site Designs) are primarily for structure, not content (files). To include files, you'll need a content migration step.

    Recommended Tool: PnP PowerShell or PnP CLI (Command Line Interface).

    • You would write a script that first creates the new site using your Site Design, and then, as a separate step, copies the files and folders from a "source" or "template" document library (which you'd maintain) to the newly created site's document library.
    • Process:
    1. Export Files: Use Get-PnPFile or Get-PnPFolder to export files from your source site.
    2. Upload Files: Use Add-PnPFile or Add-PnPFolder to upload them to the new site's document library.
    • Alternative (for smaller, static files): You could potentially have a Power Automate flow triggered by the site creation that copies a pre-defined set of "template" files into the new site's library.

     

    2.Replicate the Homepage (Modern Page Layout, Web Parts, and Branding)

    Site Designs and Site Scripts are ideal for this.

    Homepage Layout & Web Parts:

    Your Site Script (edit in Notepad, Visual Studio Code,...) can include actions to create a modern page and add specific web parts to it. You define the web parts and their properties in the JSON script.

    Example Site Script Action:

    {

    "verb": "createSitePage",

    "pageName": "Home.aspx",

    "pageLayout": "Home", // Or "Article", "Blank"

    "webParts": [

    "webPartType": "Microsoft.SharePoint.WebPart.Text",

    "id": "c1f76d6c-67c2-4903-b0b3-f09b578c7c97", // Example Text Web Part GUID

    "properties": { " text ": "<h1>Welcome to your new site!</h1><p>This is a custom homepage.</p>" }},{

    "webPartType": "Microsoft.SharePoint.WebPart.List",

    "id": "e4454c0e-4731-4091-b924-d2e379201f9c", // Example List Web Part GUID

    "properties": {

    yaml

    "listId": "{listId}", // Reference a list created earlier in the script

    "title": "Important Documents" }}

    // Add more web parts as needed ]}

    For complex existing pages, you might need to manually inspect the page's JSON (by appending ?pagemode=edit&viewmode=0 to the page URL and then viewing source/network tab for the page's data) to extract web part configurations or use PnP PowerShell to export page details.

    Branding (Theme):

    Your Site Script can apply a custom theme. You would define the theme colors and fonts, upload them to your tenant, and then reference the theme in your Site Script.

    Example Site Script Action:

    {

    "verb": "applyTheme",

    "themeName": "YourCustomThemeName"

    }

    3.Create a Planner Plan Automatically (Linked to the Site’s Microsoft 365 Group)

    Planner plans are tied to Microsoft 365 Groups. When you create a modern SharePoint Team Site, it automatically creates an associated Microsoft 365 Group.

    Recommended Tool: PnP PowerShell (using Microsoft Graph API) or Microsoft Power Automate.

    • PnP PowerShell: You can use PnP PowerShell cmdlets that interact with Microsoft Graph to create a Planner plan and link it to the group associated with the new SharePoint site. This is typically done as a post-provisioning step in your script.
    • Power Automate: You can create a flow that is triggered when a new SharePoint site is created. The flow can then use the "Planner" connector to create a new plan within the site's associated Microsoft 365 Group. You can even add initial buckets and tasks.

     

    Alternatively, PnP Provisioning method:

    This process uses two key PowerShell commands.

    Step 1: Extract a Template from an Existing Site

    First, create a "template" site in SharePoint with the exact lists, libraries, pages, and branding you want. Once it's perfect, use this command to save its structure into a template file.
    Connect to your source site

    Connect-PnPOnline -Url https://[your_tenant].sharepoint.com/sites/[your_source_site]
    Get the provisioning template and save it to an XML file

    Get-PnPProvisioningTemplate -Out "C:\temp\MySiteTemplate.xml"

    This command automatically generates a comprehensive template file (.xml) that includes all the structural elements of your site. It is much easier than manually writing the JSON.

    Step 2: Apply the Template to a New Site

    Now, to create a new site with the same structure, you just need to connect to that new site and apply the template file you just created.
    Connect to your new, empty site

    Connect-PnPOnline -Url https://[your_tenant].sharepoint.com/sites/[your_new_site]

    Apply the template to the new site

    Invoke-PnPProvisioningTemplate -Path "C:\temp\MySiteTemplate.xml"

    This single command will apply all the lists, libraries, pages, and other settings from your template file to the new site.

    The PnP Provisioning Engine method, while easier for the SharePoint site itself, does not automatically capture or provision the Planner plan.

    To include the Planner plan, you would need to combine the PnP Provisioning process with a separate step that uses PowerShell to interact with the Microsoft Graph API.

     

    For references: 

    Get started creating SharePoint site templates and site scripts | Microsoft Learn
    PnP PowerShell | PnP PowerShell

    This is a complex provisioning task that requires a good understanding of multiple tools. I sincerely recommend that you submit a support ticket to work directly with a Microsoft support engineer who can provide more detailed guidance tailored to your specific environment.

    • As a Microsoft 365 Administrator, go to the Microsoft 365 Admin Center.
    • Navigate to Support > New service request.
    • Clearly describe your goal of creating a site template with files, a homepage, and an automated Planner plan.
    • Mention that you are looking for guidance on using modern provisioning methods like Site Designs, PnP PowerShell, or Power Automate.

    This will get you in touch with a support specialist who can provide step-by-step assistance.

    I hope this information helps clarify the situation and provides you with workable solutions. Should you have any further questions or need additional assistance, please don't hesitate to reach out. We're always here to help. Have a wonderful day!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.