I made a (simple) sitescripttemplate in JSON which I would like to make available for all the users who can create a site.
The inconvenience lies in the fact I only got it working which I write the whole jsoncode in the same PS1 file.
Rather I would prefer to load a file from a directory and work with that content. As you see in my code below
$site_script = Get-Content -Path "./siteTemplate1.json" $SiteScript = Add-SPOSiteScript -Title "SiteTemplate1" -Content $site_script -Description "SiteTemplate1" Add-SPOSiteDesign -Title "SiteTemplate1" -WebTemplate "64" -SiteScripts $SiteScript.Id -Description "SiteTemplate1" error I get
Add-SPOSiteScript : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Content'. Specified method is not supported. At line:1 char:78 + ... ipt -Title "SiteTemplate_JoinHubSite" -Content $site_script -Descr ... + ~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Add-SPOSiteScript], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Online.SharePoint.PowerShell.AddSPOSiteScript Thank you Hero to look in to this...
$site_script = Get-Content -Path "./siteTemplate1.json" -Rawand try