Creates and apply site designs
Summary
Creating site designs provides an option to easily provision sites consistently.
More about site design https://learn.microsoft.com/sharepoint/dev/declarative-customization/site-design-overview
$adminSiteUrl = "https://tenant-admin.sharepoint.com/"
$siteUrl = "https://tenant.sharepoint.com/sites/Project"
#path where to store the site script
$siteScriptFile = "C:\temp\ProjectSite1.json";
$relativeListUrls = "/Lists/Issue tracker list", "/Lists/Progress tracker list";
$siteScriptTitle = "Test Project Site Common Script"
$siteDesignTitle = "Test Project Site Design"
$webTemplate = "64" #64 = Team Site, 68 = Communication Site, 1 = Groupless Team Site
$siteDesignDescription = "Test project site design with external sharing disabled and Issue tracker and progress tracker"
$previewImageUrl = "https://tenant.sharepoint.com/sites/Project/Assets/siteicon.png"
Connect-PnPOnline -url $siteUrl -interactive
#Team Site, only once and modify to include options to remove links and other actions
$extracted = Get-PnPSiteScriptFromWeb –Url $siteUrl -Lists $relativeListUrls -IncludeRegionalSettings -IncludeSiteExternalSharingCapability -IncludeTheme -IncludeLinksToExportedItems -IncludeBranding
$extracted | Out-File $siteScriptFile
$siteScript = Add-PnPSiteScript -Title $siteScriptTitle -Content (Get-Content $siteScriptFile -Raw)
$siteDesign = Add-PnPSiteDesign -SiteScriptIds $siteScript.Id -Title $siteDesignTitle -WebTemplate $webTemplate -Description $siteDesignDescription -PreviewImageUrl $previewImageUrl
Grant-PnPSiteDesignRights -Identity $siteDesign -Principals "testuser1@tenant.onmicrosoft.com"
Note
SharePoint tenant admin right are required to be able add site design
Check out the PnP PowerShell to learn more at: https://aka.ms/pnp/powershell
The way you login into PnP PowerShell has changed please read PnP Management Shell EntraID app is deleted : what should I do ?
Contributors
Author(s) |
---|
Reshmee Auckloo |
Disclaimer
THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.