Get Site Template For SharePoint Online Site

Introduction

In SharePoint Online, it is sometimes needed to get the site template ID being used for the existing site collection. There are multiple ways to get it. Unfortunately, there isn’t a straightforward way. Let's discuss the UI way and PowerShell way. 

Using Page source

In the SharePoint site collection home page, right click on the site and click on ‘View Source’ and search for “webTemplateConfiguration”.

Get Site Template for SharePoint Online Site

In this case, the template that is used is ‘Communication Site’. You can refer to the table mapping by Vlad in the references section.

Usually, when you go to create site page in SharePoint, as an end user you could create the following

  • Team site (with office 365 group)
  • Communication Site (a dynamic web that has no Office 365 groups associated)

As a SharePoint admin, there are other templates that can be created by the admin. Those are under “Modern Experience” and as well as ‘Classic Experience”.

Modern Experience

  • Team Site (No office group connected)
  • Document Center
  • Enterprise Wiki
  • Publishing Portal
  • Project Web App site
  • Content center

Classic Experience

Collaboration

  • Team Site (Classic Experience)
  • Developer site
  • Project Site
  • Community Site

Enterprise

  • Document Center
  • eDiscovery Center
  • Records Center
  • Team Site – SharePoint online configuration
  • Compliance Policy Center
  • Enterprise Search Center
  • My Site Host
  • Community Portal
  • Basic Search Center

Publishing

  • Publishing Portal
  • Enterprise Wiki

Below is the table that shows commonly created sites. You can refer to site templates from Vlad’s blog which I have mentioned in the references section.

Name Template ID
Communication Site SITEPUBLISHING#0
Team Site (with O365 group) GROUP#0
Team Site (stand alone site) STS#3

Using PowerShell

You can use SPO PowerShell and PnP module to get the site template that is being used.

Below are the steps for PnP PowerShell module,

Step 1

Connect to tenant admin URL using either SharePoint or Global Admin credentials.

Connect-PnPOnline -Url $tenantURL -Credentials $creds

Note: If your organization has enabled SSO (single sign on) for service accounts then you need to use the parameter -interactive.

Connect-PnPOnline -Url $tenantURL -interactive

Step 2

Run the Get-PnPTenantSite command to get the template ID

The PnP PowerShell command to get the site template is

Get-PnPTenantSite -Identity "https://contoso.sharepoint.com/teams/qaVinay" -Detailed | select Template

Get Site Template for SharePoint Online Site

Below are the steps for SPO PowerShell module.

Step 1

Connect to tenant admin URL using either SharePoint or Global Admin credentials.

Connect-SPOService-Url$tenantURL-Credential$creds

Step 2

Run the Get-SPOSite command to get the template ID

Get-SPOSite -Identity "https://contoso.sharepoint.com/teams/qaVinay" -Detailed | select Template

Get Site Template for SharePoint Online Site

Conclusion

Thus, in this article, we have seen how to get the site template ID for a SharePoint Online site collection using the page source (UI way) and PowerShell way. 

References