Overcome the 30 action site script limitation in SharePoint Online

This blog post pertains to invoking site designs using PowerShell and not through the SharePoint UI. Increasing the 30 action limit through the UI/UX will be supported soon!

During Ignite in Orlando this year, I had the pleasure to see Sean Squires present on the the latest and greatest features for site provisioning in SharePoint Online. He spoke about some of the future updates coming that will help get over some of the limitations of site designs and site scripts.

What 30 action limit?

When site designs and site scripts were first released, there was a limit of 30 actions that could be used in a site script. These actions include:

  • Creating a content type
  • Creating a list
  • Adding a content type to a list
  • creating list columns
  • setting regional settings
  • deploying SPFx solutions
  • and more…

That means if you started using site scripts when they were first released and you needed to deploy a large amount of customization, you’d have to do this with PowerShell and Azure Functions using the “triggerFlow” action.

Introducing Add-SPOSiteDesignTask

During Ignite, Sean announced that new PowerShell commandlets would be available to increase this limitation from 30 to an extremely high number (100k characters apparently). The release of this has seemingly gone under the radar, but is now available for use!

Add-SPOSiteDesignTask is meant to replace the existing Invoke-SPOSiteDesign. The command is used to apply an already publishing site design to any target site collection. This means there is still a limit of 30 actions when creating sites from the SharePoint UI.

However, unlike Invoke-SPOSiteDesign, the command doesn’t run the site design immediately, instead the site design invocation is put into a schedule to run.

Testing it out

I’ve created a basic site design and site script that run 30+ actions onto a SharePoint site collection. The site script will create 33 site columns, a custom list and apply the columns to the list.

$script = @'
  {
                  "$schema": "schema.json",
                   "actions": [
                            {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn1",
                                "displayName": "Test Column1",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn2",
                                "displayName": "Test Column2",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn3",
                                "displayName": "Test Column3",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn4",
                                "displayName": "Test Column4",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn5",
                                "displayName": "Test Column5",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn6",
                                "displayName": "Test Column6",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn7",
                                "displayName": "Test Column7",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn8",
                                "displayName": "Test Column8",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn9",
                                "displayName": "Test Column9",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn10",
                                "displayName": "Test Column10",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn11",
                                "displayName": "Test Column11",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn12",
                                "displayName": "Test Column12",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn13",
                                "displayName": "Test Column13",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn14",
                                "displayName": "Test Column14",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn15",
                                "displayName": "Test Column15",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn16",
                                "displayName": "Test Column16",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn17",
                                "displayName": "Test Column17",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn18",
                                "displayName": "Test Column18",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn19",
                                "displayName": "Test Column19",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn20",
                                "displayName": "Test Column20",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn21",
                                "displayName": "Test Column21",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn22",
                                "displayName": "Test Column22",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn23",
                                "displayName": "Test Column23",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn24",
                                "displayName": "Test Column24",
                                "isRequired": false
                               }, {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn25",
                                "displayName": "Test Column25",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn26",
                                "displayName": "Test Column26",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn27",
                                "displayName": "Test Column27",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn28",
                                "displayName": "Test Column28",
                                "isRequired": false
                               }, {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn29",
                                "displayName": "Test Column29",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn30",
                                "displayName": "Test Column30",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn31",
                                "displayName": "Test Column31",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn32",
                                "displayName": "Test Column32",
                                "isRequired": false
                               },
                                {
                                "verb": "createSiteColumn",
                                "fieldType": "Text",
                                "internalName": "testColumn33",
                                "displayName": "Test Column33",
                                "isRequired": false
                               },
                        {
                           "verb": "createContentType",
                           "name": "Test CT",
                           "description": "custom content type",
                           "parentName": "Item",
                           "hidden": false,
                           "subactions": [                         
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn1"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn2"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn3"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn4"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn5"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn6"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn7"
                               },{
                               "verb": "addSiteColumn",
                               "internalName":"testColumn8"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn9"
                               },{
                               "verb": "addSiteColumn",
                               "internalName":"testColumn10"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn11"
                               },{
                               "verb": "addSiteColumn",
                               "internalName":"testColumn12"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn13"
                               },{
                               "verb": "addSiteColumn",
                               "internalName":"testColumn14"
                               },{
                               "verb": "addSiteColumn",
                               "internalName":"testColumn15"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn16"
                               },{
                               "verb": "addSiteColumn",
                               "internalName":"testColumn17"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn18"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn19"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn20"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn21"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn22"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn23"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn24"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColum25"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn26"
                               },{
                               "verb": "addSiteColumn",
                               "internalName":"testColumn27"
                               },
                              {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn28"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn29"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn30"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn31"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn32"
                               },
                               {
                               "verb": "addSiteColumn",
                               "internalName":"testColumn33"
                               },
                               
                            ]
                       },
                       {
                        "verb": "createSPList",
                        "listName": "Custom List",
                        "templateType": 100,
                        "subactions": [
                           {
                            "verb": "addContentType",
                            "name": "Test CT"
                           }                      
                         ]
                        }
            
              
                   ],
                   "bindata": { },
               "version": 1
              }
              
              }

}
'@

I have added this site script to SharePoint using the Add-SPOSiteScript command and subsequently added the site script to a new site design using Add-SPOSiteDesign.

Add-SPOSiteScript -Title "LongSiteScript" -Description "Long Site Script" -Content $script
-returned id = 0aa8ce3a-0a7f-4963-bd0f-07ce28a6a5dd

Add-SPOSiteDesign -Title "Long Action Site Design" -WebTemplate "0" -SiteScripts "0aa8ce3a-0a7f-4963-bd0f-07ce28a6a5dd" -Description "Long Action Test"
-return id = d082fc0e-9a49-4675-88ac-d49e0931670e

Using Add-SPOSiteDesignTask

Now that I have created a long site script and the associated site design, it’s time to run the site design on an existing site. I will invoke the site design using Add-SPOSiteDesignTask and passing in the WebUrl and the SiteDesignId from my new site design.

Add-SPOSiteDesignTask -SiteDesignId d082fc0e-9a49-4675-88ac-d49e0931670e -WebUrl https://yourtenantsite.sharepoint.com/sites/testlongscript

After invoking the command, PowerShell is going to output some information for you. It will provide the ID of the new task as well as the associated site design that was provisioned.

Add-SPOSiteDesignTask -SiteDesignId d082fc0e-9a49-4675-88ac-d49e0931670e -WebUrl https://yourtenantsite.sharepoint.com/sites/testlongscript

Id : e4ff3264-c7b1-4121-b179-445382216703
SiteDesignId : d082fc0e-9a49-4675-88ac-d49e0931670e
WebId : 42a2b14c-ce2a-485e-8854-92d3b334704f
SiteId : f848c5a3-9c6b-40f6-becd-8c5661f0e558
LogonName : i:0#.f|membership|beau@cameronsoft.onmicrosoft.com

Checking the results

After waiting a minute or so, I was able to see the reflected changes in my environment.

ContentType

To learn more about Add-SPOSiteDesignTask, the documentation can be found here.

One thought on “Overcome the 30 action site script limitation in SharePoint Online

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s