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