Introduction
According to MSFT documentation, Invoke-SPOSiteDesign will apply the site designs and associated site scripts to the existing SharePoint online modern sites. Imagine if you have a predefined set of lists and libraries and custom solutions that need to be created for a particular business use case; in that case, instead of repetitive actions, you can create a Site Design that can be saved and later applied to existing or new SharePoint online modern sites. More about the Site Designs and Site Scripts can be found in the references section.
In this blog post, I would like to mention the limitations of the Invoke-SPOSiteDesign action. Invoke-SPOSiteDesign is a SharePoint Online PowerShell module function that will apply existing Site Design to SharePoint online sites. When running this command, there is no error that is being thrown, however, the Site Design is not getting applied. Below is the command that was run in my scenario.
# replace the Identity and WebUrl that are associated with your parameters.
Invoke-SPOSiteDesign -Identity “gerwtyru-g9cy-12we-123edefrty” -WebUrl “https://tailspin.sharepoint.com/sites/mycsutomsite”
Reason
Invoke-SPOSiteDesign has a limitation: it can only run up to 30 actions. In my case, I have more than 30 actions which is why the Invoke-SPOSiteDesign is not working.
Alternatives
The alternative action that can be used in this case is to use Add-SPOSiteDesignTask. This action will schedule the site design task to run in the next couple of minutes. Most probably within 5 minutes, the actions are applied, and the site design is reflected in respective SharePoint online modern sites. Replace the parameters -SiteDesignId and -WebUrl with respect to your scenario.
Add-SPOSiteDesignTask -SiteDesignId "gerwtyru-g9cy-12we-9aa3-123edefrty" -WebUrl "
https://tailspin.sharepoint.com/teams/CustomTemplateDemo"
If you are using the PnP PowerShell module, then use the command Add-PnPSiteDesignTask.
Add-PnPSiteDesignTask -SiteDesignId "gerwtyru-g9cy-12we-9aa3-123edefrty" -WebUrl "
https://tailspin.sharepoint.com/teams/CustomTemplateDemo"
Note. For PnP modules, you need to save the current connection to the site in a variable and use that as a connection parameter. For more information on how to connect to the SPO site using PnP Modules, please visit the references section.
Conclusion
Thus, in this blog post, we have seen the limitations of Invoke-SPOSiteDesign and how we can overcome them using alternative options.
References