Apr 15, 2018

Convert CAML List Schema to Site Scripts

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.

.\\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

dotnet YPCode.CAML2SiteDesigns.CLI.dll convert-list-schema -s  schema.xml -o output.json

And here we go, we have now our site script JSON generated in the file output.json


Currently this tool only support title, description and fields of the list, Content Types and Views are not supported just yet. If you want to take a look at the code, check out the GitHub repo.

Hope you will enjoy creating site scripts from existing lists and libraries



Other posts