So it really bothers me that it is somewhat difficult to identify the sites that you create based on a template. The answer to that problem is altering the property bag and adding a custom attribute to your web template.

The project has been altered based on the only decent blog post on web templates here: and the comments placed here by Vasilli

The magic happens by creating a folder (PropertyBag) then creating an empty element inside that folder. Add in your propertybag attribute then create a new feature scoped at Site. Add in your newly created element to that feature and take note of the ID of the feature. Now go back to your onet.xml of your web template and add that feature to the web features section.

Real simple right? We are doing it this way because we are trying to do this without writing any code. The less code the less issues you will have with O365.

With the propertybag values attached to the site, it is now possible to iterate your subsites and find all the sites that used your stunningly beautiful web template.

Random code snippets that gets the properties for a specified site.

var webProperties = hostcontext.getweb().getallProperties();
clientContext.executeQueryAsync(Function.createDelegate(this, function () { getWebPropertiesSucceeded(webProperties,propertyname); }), Function.createDelegate(this, onQueryFailed));

function getWebPropertiesSucceeded(webProperties,propertyname) {

var templatename = webProperties.get_item(propertyname);

Last edited Aug 12, 2014 at 1:35 AM by bitterac, version 1


No comments yet.