Hi guys,
Recently Microsoft released upgraded capabilities for Site Designs and Site Scripts on SharePoint Online
If you want to know more about SPO Site Designs, check out the following docs. You can also check out the Site Designs Studio, a tool I built for editing Site Designs and Site Scripts from a user-friendly interface.
Add field as XML
One of these recently added capabilities allow to add fields to lists from their XML schema. Relying on this feature, we can know easily convert existing lists and libraries schema to a Site Script. This will allow a kind of template extraction from existing lists.
Actually, I built a small .NET Core tool that will do that for you, you will need to install the .NET Core runtime if you don’t already have it.
First of all, you will need the list XML schema, to get it you can use the following API endpoint (replacing yourtenant and yoursite by the appropriate values):
https://yourtenant.sharepoint.com/sites/yoursite/_api/lists/getbytitle(‘name_of_your_list’)/SchemaXml
Copy/Paste the entire CAML of the <List > element and paste it into a new file
Download the archive here, extract its content and from a PowerShell console, call the following command:
PS> .\ConvertListSchemaToSiteScript.ps1 -ListSchemaXml schema.xml -Output output.json
Alternatively, if you want to run this tool from a non-Windows system, with the .NET Core runtime installed, you can execute the following command
