0

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

2 Answers 2

0

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

1
  • That's what i feared :/ Thanks for the answer, anyways :) Jun 14, 2012 at 8:16
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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