Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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);
        context.load(this.sites);        

        context.executeQueryAsync(
        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;
    while(items.moveNext())
    {
        try
        {
            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

2 Answers 2

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

 
discard

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.