Get Site Templates in SharePoint Online using PowerShell

Requirement: Get Site Templates in SharePoint Online using PowerShell.

How to Get Site Templates in SharePoint Online?

Site templates are the building blocks of sites in SharePoint Online. They define the site’s structure, data, functionality, and look and feel. SharePoint Online provides different site templates out-of-box to create sites quickly. The “Template Selection” section on the create site page gives you the list of site templates in SharePoint Online.

  1. Login to SharePoint Admin Center https://YourDomain-admin.sharepoint.com/ >> Expand Sites >> Active Sites.
  2. Click on the “Create” button in the toolbar >> Pick “Other options”.
  3. Click on “Choose Template” and then select “More Templates” from the dropdown.
  4. This will take you to the Classic site creation page to select from a variety of templates.
sharepoint online get web template

You need the site template to create sites in SharePoint. Picking the site template from the web user interface is fine, but how to get the site templates in SharePoint Online from PowerShell?

PowerShell to Get Site Template in SharePoint Online

You need the site template ID when creating a site or site collection in SharePoint Online. Here is the PowerShell to get site templates in SharePoint Online, and the Get-SPOWebTemplate cmdlet gets you the SharePoint Online site template list.

#Variables for Admin Center & Site Collection URL
$AdminCenterURL = "https://crescent-admin.sharepoint.com/"

#Connect to SharePoint Online
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)

#Get site template list
Get-SPOWebTemplate

This retrieves SharePoint Online site template ID list for PowerShell:

get site template sharepoint online powershell

While the above PowerShell cmdlet gives you the list of all OOTB site templates, how to get custom site templates?

SharePoint Online: Get Custom Site Templates using PowerShell

Here is how to get site templates in SharePoint Online using PowerShell:

#Load SharePoint Online Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Set parameter values
$SiteURL = "https://crescenth.sharepoint.com"

$Cred= Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
 
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Credentials
         
#Get the Custom Site Template
$SiteTemplates = $Ctx.Site.GetWebTemplates("1033","0")
$Ctx.Load($SiteTemplates)
$Ctx.ExecuteQuery()

#Remove all users from the group
ForEach($Template in $SiteTemplates)
{
    $Template | Select Name, ID, Description
}

PnP PowerShell to Get SharePoint Online Site Templates

The “Get-PnPWebTemplates” cmdlet in SharePoint Online retrieves all default web templates. Let’s use PnP PowerShell to get site templates in SharePoint online, including custom site templates.

#Config Variables
$SiteURL = "https://Crescent.sharepoint.com/"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#Get the Context & Web Objects
$ClientContext = Get-PnPContext
$Web = Get-PnPWeb

#Get All Web Templates
$WebTemplateCollection = $Web.GetAvailableWebTemplates(1033,0)
$ClientContext.Load($WebTemplateCollection)
$ClientContext.ExecuteQuery()

#Get the Template Name and Title
$WebTemplateCollection | Select ID, Name, Title

This gets you the SharePoint Online site template id list using PnP PowerShell.

SharePoint Online site template ID List for PowerShell

Here is the list of templates, along with their ID – available in SharePoint Online:

IdNameTitle
0GLOBAL#0Global template
1STS#3Team site (no Microsoft 365 group)
1STS#0Team site (classic experience)
1STS#1Blank Site
1STS#2Document Workspace
2MPS#0Basic Meeting Workspace
2MPS#1Blank Meeting Workspace
2MPS#2Decision Meeting Workspace
2MPS#3Social Meeting Workspace
2MPS#4Multipage Meeting Workspace
3CENTRALADMIN#0Central Admin Site
4WIKI#0Wiki Site
9BLOG#0Blog
15SGS#0Group Work Site
16TENANTADMIN#0Tenant Admin Site
17APP#0App Template
18APPCATALOG#0App Catalog Site
2764ACCSRV#0Access Services Site
2757ACCSVC#0Access Services Site Internal
2757ACCSVC#1Access Services Site
7BDR#0Document Center
6001CONTENTCTR#0Content Center
3400TBH#0In-Place Hold Policy Center
95DEV#0Developer Site
3300EDISC#0eDiscovery Center
3300EDISC#1eDiscovery Case
1611EXPRESS#0Express Team Site
10043FunSite#0SharePoint Online Tenant Fundamental Site
14483OFFILE#0(obsolete) Records Center
14483OFFILE#1Records Center
2009EHS#0Express Hosted Site
2009EHS#2Public Publishing Portal
2009EHS#1Team Site – SharePoint Online configuration
40OSRV#0Shared Services Administration Site
3100PPSMASite#0PerformancePoint
3200BICenterSite#0Business Intelligence Center
6221PWA#0Project Web App Site
6215PWS#0Microsoft Project Site
6000REVIEWCTR#0Review Center
301RedirectSite#0Redirect Site
3500POLICYCTR#0Compliance Policy Center
20SPS#0SharePoint Portal Server Site
21SPSPERS#0SharePoint Portal Server Personal Space
21SPSPERS#2Storage And Social SharePoint Portal Server Personal Space
21SPSPERS#3Storage Only SharePoint Portal Server Personal Space
21SPSPERS#4Social Only SharePoint Portal Server Personal Space
21SPSPERS#5Empty SharePoint Portal Server Personal Space
21SPSPERS#6Storage And Social SharePoint Portal Server Personal Space
21SPSPERS#7Storage And Social SharePoint Portal Server Personal Space
21SPSPERS#8Storage And Social SharePoint Portal Server Personal Space
21SPSPERS#9Storage And Social SharePoint Portal Server Personal Space
21SPSPERS#10Storage And Social SharePoint Portal Server Personal Space
21SPSPERS#11Consumer OneDrive
21SPSPERS#12JIT OneDrive Business
22SPSMSITE#0Personalization Site
30SPSTOC#0Contents area Template
31SPSTOPIC#0Topic area template
32SPSNEWS#0News Site
39CMSPUBLISHING#0Publishing Site
53BLANKINTERNET#0Publishing Site
53BLANKINTERNET#1Press Releases Site
53BLANKINTERNET#2Publishing Site with Workflow
33SPSNHOME#0News Site
34SPSSITES#0Site Directory
36SPSCOMMU#0Community area template
38SPSREPORTCENTER#0Report Center
47SPSPORTAL#0Collaboration Portal
50SRCHCEN#0Enterprise Search Center
51PROFILES#0Profiles
52BLANKINTERNETCONTAINER#0Publishing Portal
54SPSMSITEHOST#0My Site Host
56ENTERWIKI#0Enterprise Wiki
6115PROJECTSITE#0Project Site
59PRODUCTCATALOG#0Product Catalog
62COMMUNITY#0Community Site
63COMMUNITYPORTAL#0Community Portal
64GROUP#0Team site
65POINTPUBLISHINGHUB#0PointPublishing Hub
66POINTPUBLISHINGPERSONAL#0Personal blog
66POINTPUBLISHINGPERSONAL#1Personal blog
67POINTPUBLISHINGTOPIC#0PointPublishing Topic
68SITEPAGEPUBLISHING#0Communication site
69TEAMCHANNEL#0Team Channel
69TEAMCHANNEL#1Team Channel
90SRCHCENTERLITE#0Basic Search Center
90SRCHCENTERLITE#1Basic Search Center
10100TenantAdminSpo#0SharePoint Online TenantAdmin
30003TestSite#0Test Site
61visprus#0Visio Process Repository
1015SAPWorkflowSite#0SAP Workflow Site

If you want to find the site template of an existing site, use: How to Find the Site Template in SharePoint Online using PowerShell?

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *