Using a PS script – how to I set specific permissions when creating a SharePoint site template
I am using this as a guide: https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview#anatomy-of-a-site-script As usual most MS documentation leave out the most important parts :). My script uses JSON:
$site_script = @”
{
“$schema”: “schema.json”,
“actions”: [
{
“verb”: “setSiteExternalSharingCapability”,
“capability”: “Disabled”
},
{
“verb”: “setSitePermission”,
“permissionKind”: “UseClientIntegrationFeatures”,
“principal”: “Everyone”,
“propagateAcl”: false,
“remove”: true
},
{
“verb”: “setSiteBranding”,
“themeName”: “SiteTemplateBranding”,
“navigationLayout”: “Megamenu”,
“headerLayout”: “Compact”,
“headerBackground”: “Strong”,
“showFooter”: true
},
{
“verb”: “setSiteLogo”,
“url”: “https://etc…”
}
],
“bindata”: { },
“version”: 1
}
“@
$addSiteScript = Add-SPOSiteScript -Title $themeName -Content $site_script -Description “Communication site which removes data export for modern experience and adds branding.”
Write-Host $addSiteScript.Id
Add-SPOSiteDesign -Title $themeName -WebTemplate “68” -SiteScripts $addSiteScript.Id -Description “”
This script successfully creates a site template but it errors when I use “verb”: “setSitePermission”,
Anyone know what the correct syntax is?
I am using this as a guide: https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview#anatomy-of-a-site-script As usual most MS documentation leave out the most important parts :). My script uses JSON: $site_script = @”
{
“$schema”: “schema.json”,
“actions”: [
{
“verb”: “setSiteExternalSharingCapability”,
“capability”: “Disabled”
},
{
“verb”: “setSitePermission”,
“permissionKind”: “UseClientIntegrationFeatures”,
“principal”: “Everyone”,
“propagateAcl”: false,
“remove”: true
},
{
“verb”: “setSiteBranding”,
“themeName”: “SiteTemplateBranding”,
“navigationLayout”: “Megamenu”,
“headerLayout”: “Compact”,
“headerBackground”: “Strong”,
“showFooter”: true
},
{
“verb”: “setSiteLogo”,
“url”: “https://etc…”
}
],
“bindata”: { },
“version”: 1
}
“@
$addSiteScript = Add-SPOSiteScript -Title $themeName -Content $site_script -Description “Communication site which removes data export for modern experience and adds branding.”
Write-Host $addSiteScript.Id
Add-SPOSiteDesign -Title $themeName -WebTemplate “68” -SiteScripts $addSiteScript.Id -Description “” This script successfully creates a site template but it errors when I use “verb”: “setSitePermission”,Anyone know what the correct syntax is? Read More