Site design JSON schema

Note

Site designs and site scripts are currently in preview and are subject to change. They are not currently supported for use in production environments.

The site design is a list of actions. For more complex actions, such as creating a list, there are also subactions. Each action is specified by a "verb" value. Verb actions are run in the order they appear in the JSON script.

The overall JSON structure is specified as follows:

{
    "$schema": "schema.json",
        "actions": [
            ...
            <one or more verb actions>
            ...
        ],
        "bindata": { },
        "version": 1
};

Create a new SharePoint list

Use the createSPList verb to create a new SharePoint list.

JSON values:

  • listName - The name of the list for users to identify it with.
  • templateType - Which template to apply to the list. Typically you would use value 100. Template type values are documented in SPListTemplateType enumeration.
  • subactions - An array of actions that run in the order listed to create your list.

Example:

{
    "verb": "createSPList",
    "listName": "Customer Tracking",
    "templateType": 100,
    "subactions": [
        {
            "verb": "setDescription",
            "description": "List of Customers and Orders"
         }
    ]
}

The subactions array provides additional actions to specify how to construct the list. Subactions are also specified using a verb value.

setTitle

Sets a title which identifies the list in views.

JSON value:

  • title - The title of the new list.

Example:

{
   "verb": "setTitle",
   "title": "Customers and Orders"
}

setDescription

Sets the description of the list.

JSON value:

  • description - The description of the new list.

Example:

{
   "verb": "setDescription",
   "description": "List of Customers and Orders"
}

addSPField

Adds a new field.

JSON values:

  • fieldType - The field type can be set to Text, Note, Number, Boolean, User, or DateTime.
  • displayName - The display name of the field.
  • isRequired - True if this field is required to contain information; otherwise, false.
  • addToDefaultView - True if the field will be added to the default view; otherwise, false.

Example:

{
   "verb": "addSPField",
   "fieldType": "Text",
   "displayName": "Customer Name",
   "isRequired": false,
   "addToDefaultView": true
}

deleteSPField

Deletes a default field that was provided by the selected template type.

JSON value:

  • displayName - The display name to identify the field to delete.

Example:

{
   "verb": "deleteSPField",
   "displayName": "Modified"
}

addContentType

Adds a content type to the list.

JSON value:

  • name - The name of the content type to add.

Example:

{
   "verb": "addContentType",
   "name": "name"
}

removeContentType

Removes a content type that was provided by the selected template type.

JSON value:

  • name - The name of the content type to remove.

Example:

{
   "verb": "removeContentType",
   "name": "name"
}

setSPFieldCustomFormatter

Sets column formatting for a field. For more information on column formatting see Use column formatting to customize SharePoint.

JSON values:

  • fieldDisplayName - The display name of the field to operate on.
  • formatterJSON - A JSON object to use as the field CustomFormatter.

Example:

{
   "verb": "setSPFieldCustomFormatter",
   "fieldDisplayName": "name",
   "formatterJSON": "json" 
}

Use the addNavLink verb to add a new navigation link to the site.

JSON values:

  • url - The url of the link to add.
  • displayName - The display name of the link.
  • isWebRelative - True if the link is web relative; otherwise, false.

Example:

{
   "verb": "addNavLink",
   "url": "/Customer Event Collateral",
   "displayName": "Event Collateral",
   "isWebRelative": true
}

Apply a theme

Use the applyTheme verb to add a theme to the site. For more information on themes, see SharePoint site theming.

JSON value:

  • themeName - The name of the theme to apply.

Example:

{
   "verb": "applyTheme",
   "themeName": "Blue Yonder"
}

Use the setSiteLogo verb to specify a logo for your site. This action only works on the communication site template (68).

JSON value:

  • url - The url of the logo image to use.

Example:

{
    "verb": "setSiteLogo",
    "url": "/Customer Event Collateral/logo.jpg"
}

Join a hub site

Use the joinHubSite verb to join the site to a hub.

JSON value:

  • hubSiteId - The ID of the hub site to join.

Example:

{
    "verb": "joinHubSite",
    "hubSiteId": "e337cc17-b355-45d2-8dd4-e056f1bcf6f6"
}

Trigger a flow

Use the triggerFlow verb to kick off a custom flow.

JSON values:

  • url - A trigger URL of the flow.
  • name - The name of the flow.
  • parameters - An optional set of parameters to pass into the flow.

Example:

 {
    "verb": "triggerFlow",
    "url": "<A trigger URL of the Flow.>",
    "name": "Record and tweet site creation event",
    "parameters": {
        "event": "Microsoft Event",
        "product": "SharePoint"
    }
}