SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am doing a Sharepoint project where I am displaying all subsites in a list on the home screen. I have set them up in a Microsoft Metro/Tiles design, so that each subsite represent one tile.

I am now trying to make these tiles differate in color, based on what kind of site template the subsite it represents is based on. Blue for blank site, red for wiki etc. The problem is I can't seem to access each subsites template property. Does anyone have a clue on how it could be performed? I'll attach the important parts of the code:

var sites;
ExecuteOrDelayUntilScriptLoaded(loadSites, 'SP.js');

function loadSites()
    var context = new SP.ClientContext.get_current();
    if(context != undefined && context != null) {
        var web = context.get_web();
        this.sites = web.getSubwebsForCurrentUser(null);

        Function.createDelegate(this, this.onSuccess),
        Function.createDelegate(this, this.onFailed));

function onSuccess()
    var items = this.sites.getEnumerator();
    var menuNavContent = '';
    var contentNavContent = '';
    var templates = '';

    menuNavContent += '<div id="applist">';
    menuNavContent += '<h1>Sites</h1>';
    menuNavContent += '<ul class="apps">';

    contentNavContent += '<div id="appbox">';
    contentNavContent += '<ul class="apps">';
    var counter = 1;
            var item = items.get_current();
            var itemUrl = item.get_serverRelativeUrl();
            var title = item.get_title();
            var lastItemModified = getModifiedDateString(new Date(item.get_lastItemModifiedDate()));

Any takers? :D

Best regards, Olav Gundersen

share|improve this question
up vote 0 down vote accepted

You can't do it with CSOM. What you could do is to create a custom web service and return the SPWeb.WebTemplate property.

share|improve this answer
That's what i feared :/ Thanks for the answer, anyways :) – Olav Wik Gundersen Jun 14 '12 at 8:16

With 2013 CSOM you now have access to the WebTemplate property of the web object. WebTemplateId is still missing, but takes you one step further at least.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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