Skip to content

Instantly share code, notes, and snippets.

@drift
Last active December 19, 2015 18:39
Show Gist options
  • Save drift/6000547 to your computer and use it in GitHub Desktop.
Save drift/6000547 to your computer and use it in GitHub Desktop.
Umbraco v6 change templates
var contentService = ApplicationContext.Current.Services.ContentService;
var content = contentService.GetById(1538);
//quick change lots of nodes template
var fileService = ApplicationContext.Current.Services.FileService;
var template = fileService.GetTemplate("CJ-Content");
foreach(var item in content.Children())
{
item.Template = template;
contentService.Save(item);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment