Introduction

In SharePoint Online, it is sometimes necessary 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”.

SharePoint

Web

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 a site page in SharePoint, as an end user, you could create the following.

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

Classic Experience

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 SITEPAGEPUBLISHING#0
Team Site (with O365 group) GROUP#0
Team Site (stand-alone site) STS#3


Using PowerShell

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

Below are the steps for the 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/qacontsite" -Detailed | Select-Object Template.

Template

Below are the steps for the SPO PowerShell module.

Step 1. Connect to the 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/qacontsite" -Detailed | Select-Object Template.

Command

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