Forum Discussion

ArthurWW's avatar
ArthurWW
Brass Contributor
Nov 11, 2022

How to make SharePoint templates for your company

When I want to apply a template to a SP site that I've made, I can choose from a number of Microsoft templates. The tab 'From your company' however, is completely empty. 

How can I create one or more template(s) from my company?

 

Best regards,

Arthur

  • SvenSieverding's avatar
    SvenSieverding
    Bronze Contributor

    ArthurWW 

    These are "Site Designs".
    See more information here: "https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/get-started-create-site-design"

    Basically you need to create the template as a JSON File

     $site_script = '
     {
         "$schema": "https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json",
             "actions": [
                 {
                     "verb": "createSPList",
                     "listName": "Customer Tracking",
                     "templateType": 100,
                     "subactions": [
                         {
                             "verb": "setDescription",
                             "description": "List of Customers and Orders"
                         },
                         {
                             "verb": "addSPField",
                             "fieldType": "Text",
                             "displayName": "Customer Name",
                             "isRequired": false,
                             "addToDefaultView": true
                         },
                         {
                             "verb": "addSPField",
                             "fieldType": "Number",
                             "displayName": "Requisition Total",
                             "addToDefaultView": true,
                             "isRequired": true
                         },
                         {
                             "verb": "addSPField",
                             "fieldType": "User",
                             "displayName": "Contact",
                             "addToDefaultView": true,
                             "isRequired": true
                         },
                         {
                             "verb": "addSPField",
                             "fieldType": "Note",
                             "displayName": "Meeting Notes",
                             "isRequired": false
                         }
                     ]
                 }
             ]
     }
     '

     

    Then you connect via Powershell to the SharePoint admin side and apply the template

    connect-sposervice https://<yourtenand>-admin.sharepoint.com
    
    $d=Add-SPOSiteScript -Title "Create customer tracking list" -Content $site_script -Description "Creates list for tracking customer contact information"
    
    Add-SPOSiteDesign -Title "Contoso customer tracking" -WebTemplate "64" -SiteScripts $d.Id -Description "Tracks key customer data in a list"


    Then the design is available



    There is also an older solution called  "Site Design Studio" that can kind of extract a site script from an existing site.. But the last commit is more than 2 years old and i haven't used it in a while.
    https://github.com/pnp/sp-site-designs-studio 

Resources