At SharePoint Online I have created 100 subsites using two 'custom site templates'.

  • Personal site template and
  • Business site template.

Now I want to categorize and show these subsites as Personal Subsites and Business Subsites within web part.

So for that, I want the site template name which is used by subsite using javascript object model. I googled a lot but not found anything.

Note: I have tried global variable g_wsaSiteTemplateId and web.get_webTemplate() but it giving base template name. ie STS#0, But I want Personal OR Business.

Is it possible? Kindly help.


I'm not sure tbh if there is a value stored someplace, but I guess you could check the features activated. If its a custom template created inside SharePoint there should be features with names like "PersonalModules", "BusinessModules".

var ctx = SP.ClientContext.get_current();
var feats = ctx.get_web().get_features();
ctx.load(feats, "Include(DisplayName)");

ctx.executeQueryAsync(function() { 

    // just for debug   
    feats.get_data().forEach(function(e) {      
        console.log( e.get_displayName() );

    var templateName = "Personal";
    console.log( !!feats.get_data().filter(function(e) { return e.get_displayName() == templateName+"Modules"}).length );   

  • I tried this but there are no such features as our template names. – SP Developer Aug 22 '16 at 18:27
  • @VishalM.Patil you did check in the console and not in the GUI, since the features does not show in the GUI. I checked 3 custom templates, and they all had name+"Module" – Anders Aune Aug 23 '16 at 5:21
  • Yes Anders...I checked in console and there lots of features are listed but but no such feature listed in it...Are you tried it on SharePoint online? – SP Developer Aug 23 '16 at 6:18
  • @VishalM.Patil yes, checked another tenant too now, same there. Have a template with the name "Projecttemplate", and the feature is named "ProjecttemplateModules" there – Anders Aune Aug 23 '16 at 6:25
  • Ohk...these features are in site collection features of root site. not a site features(subsite). But with these approach how can i identity current site is personal or business? – SP Developer Aug 23 '16 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.