SPWeb.WebTemplateId property

Gets the identifier (ID) of the site definition that was used to create the site.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public int WebTemplateId { get; }

Property value

Type: System.Int32
A 32-bit integer that specifies the ID. This value corresponds to the ID attribute of the Template element in Collaborative Application Markup Language (CAML).

The range of possible values for the WebTemplateId property is described in the documentation for the SPWebTemplate.WebTemplate enumeration.

When you create a custom site template by saving a site as a template and then create a new site from the custom template, the WebTemplateId property contains the ID of the site definition from which the custom template is derived.