SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

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 have an ECMA script that I'm using to build a site directory (Thank you Bill Simser). I'm trying to add additional information such as the template the site is using, and not having much luck finding all of the properties I can utilize.

I'm attempting to add something like:

var template = item.get_template();

but this is not a valid property for ecmascript.

here is the script I'm using:

            var item = items.get_current();
            var itemUrl = item.get_serverRelativeUrl();
            var title = item.get_title();
            var template = item.get_template();
            var lastItemModified = getModifiedDateString(new Date(item.get_lastItemModifiedDate()));

            menuNavContent += '<li>';
            menuNavContent += '<a href="' + itemUrl + '">' + title + '</a>';
            menuNavContent += '</li>';

            contentNavContent += '<div style="cursor:pointer;" onclick="';
            contentNavContent += "location.href='" + itemUrl + "';";
            contentNavContent += '">';
            contentNavContent += '<li class="theme_blue">';
            contentNavContent += '<div>';

            contentNavContent += '<div class="tileTitle">' + title + '</div>';
            contentNavContent += '<div class="tileSubtitle">' + lastItemModified + '</div>';

            contentNavContent += '</div>';
            contentNavContent += '</li>';
            contentNavContent += '</div>';
            menuNavContent =;
            contentNavContent = err.message;

    menuNavContent += '</ul>';
    menuNavContent += '</div>';

    contentNavContent += '</ul>';
    contentNavContent += '</div>';
share|improve this question
up vote 2 down vote accepted

The webTemplate property is not exposed by the SP.js in 2010. (It is however in 2013: However, there is a JS variable written to the page with the web template name: g_wsaSiteTemplateId. Without any server-side code, etc., that would be the only identifying mark of the template.

share|improve this answer
nice 1, I read about it somewhere but wasn't coming into my mind :) ! – Muhammad Raja May 3 '13 at 17:53
thank you for the info – Jason May 3 '13 at 18:22

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.