3

I've been testing how to create site scripts and site designs for our SharePoint online sites that use O365 groups, such as Teams sites and Communication sites. The scripts work just fine and I'm able to create the designs and select them from the drop down. But I'd like to be able to do the same thing for a team site that will not be using O365 groups. The piece where I'm having issues with is what web template to select. I know for a team site with O365 groups the value is "64", for a communication site is "68", but what should I use for the non-O365 groups team site?

Below is an example of the PS script I'm using:

$adminSiteUrl = "https:url.sharepoint.com"
$siteScriptFile = $PSScriptRoot + "\customTeamSiteScript.json"
$webTemplate = "64"
$siteScriptTitle = "Team Site Script"
$siteDesignTitle = "Team Site Design"
$siteDesignDescription = "This is a test design for Team site creation."
$previewImageUrl = "https://url.sharepoint.com/SiteAssets/logo.png"

$cred = Get-Credential
Connect-SPOService $adminSiteUrl -Credential $cred

$siteScript = (Get-Content $siteScriptFile -Raw | Add-SPOSiteScript -Title $siteScriptTitle) | Select -First 1 Id

Add-SPOSiteDesign -SiteScripts $siteScript.Id -Title $siteDesignTitle -WebTemplate $webTemplate -Description $siteDesignDescription -PreviewImageUrl $previewImageUrl

Any help is appreciated.

Thank you

1 Answer 1

2

The webtemplateId for Modern team site without O365 group is 1.

So, you can set the value as below:

$adminSiteUrl = "https:url.sharepoint.com"
$siteScriptFile = $PSScriptRoot + "\customTeamSiteScript.json"
$webTemplate = "1"

Reference - Get a list of web templates and IDs in a SharePoint site

While the reference link is quite old, one way to find out the value is to go to any document library/list and go to its settings page. They are still in classic mode and hence they contain the _spPageContextInfo object.

enter image description here

So, by simply typing _spPageContextInfo.webTemplate in the console, we get the value of the webTemplate. Unfortunately, this templateId value is not exposed programmatically, so using this workaround we can get the value. If you do the same in communication site or team site with O365 group, we get 68 and 64 respectively.

1
  • Hi Gautam! - thank you so much for the info! I found this very helpful article also that explains it more in detail. link I just wish MS would allow the modification of adding a site logo using templates 64 and 1 not just 68 which is for communication sites. Thanks again!
    – sourcecod3
    Commented Mar 8, 2019 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.