Question

I am using MS Flow to POST a HTTP request to SharePoint to create a Sub site when an item has be entered into a list.

I want to create this sub site using a site template I have saved.

enter image description here

I am trying to figure out the ID for my Sharepoint Site Template but I am not sure where this to find it? I have checked out this site but not able to find anything here:

SharePoint templates and their Ids

Any ideas how to do this?

Was it helpful?

Solution

There are two ways to find out the TemplateId for custom template:

  1. Using User Interface:

Go to the site creation page where you selects the custom site template to create new site. Locate the site template you want to use and Press F12 or Right click > Inspect Element.

enter image description here

  1. Using Programming:

The following code will return WebTemplateId using its site template name:

function CreateSubsiteByTemplateName(templateTitle) {  
    var context = new SP.ClientContext.get_current();  
    var web = context.get_web();  
    context.load(web);  
    var webTemplates = web.getAvailableWebTemplates(1033, false);  
    context.load(webTemplates);  
    context.executeQueryAsync(
    function() {  
        var enumerator = webTemplates.getEnumerator();  
        var templateId = "STS#0";  
        while (enumerator.moveNext()) {  
            var webTemplate = enumerator.get_current();  
            var webTitle = webTemplate.get_title();  
            if (webTitle == templateTitle) {  
                templateId = webTemplate.get_name();  
                break;  
            }  
        }  
        return templateId;  
    }, function(sender, args) {  
        alert(args.get_message())  
    });  
}   

References:

  1. How To Find Custom Template ID Using Template Name In SharePoint.
  2. Microsoft Flow – Create a new sub site using Microsoft Flow!.
  3. Create SharePoint site by custom template and grant permissions in Microsoft Flow.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top