Forum Discussion

llambert1110's avatar
llambert1110
Copper Contributor
Aug 05, 2022
Solved

Standard Folder Structure for Organization Template Schema

I would like to create an organization template for hub users, that automatically adds a default folder structure with subfolders. I started by creating a sample site and retrieved its schema. Now I ...
  • kalpeshvaghela's avatar
    Aug 06, 2022

    llambert1110 

     

    By default Get-SPOSiteScriptFromWeb command will not include folder structure from document library. 

    For that you need to update Site Design / Script JSON before adding it as Organization Template. There you can provision folder using list sub action called "addFolder". 


    Official JSON Schema for supported action: https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json 

     

    I have created sample JSON schema to provision folder inside document library:

     

    {
        "$schema": "https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json",
        "actions": [
            {
                "verb": "createSPList",
                "listName": "MyDocuments",
                "templateType": 101,
                "subactions": [
                    {
                        "verb": "setDescription",
                        "description": "List of Customers and Orders"                
                    },
                    {
                        "verb": "addFolder",
                        "path": "Folder1"
                    },
                    {
                        "verb": "addFolder",
                        "path": "Folder2"
                    },
                    {
                        "verb": "addFolder",
                        "path": "Folder1/Folder11"
                    }
                    
                ]
            }
    
        ],
        "version": 2
    }

     

    Hope it will help to you and if it does then request you to mark this as answer or like it. 

     

Resources