If memory serves then probably the best way to go about this is to use the ContentService to retrieve your content. If your template has already been created, then you should be able to use the FileService and
GetTemplate("TemplateIdHere");
to retrieve the template and from there you can get the template Id and set it on your content via the TemplateId property.
Don't forget to either save or publish via the ContentService it for the changes to take affect!
Replace the existing template to another template
Hi , We are using Umbraco version 8.18.5 . I need to replace the current template of the content to another template .
Is there any way to achieve this through any package or programmatically ?
Since our site contains more than 20 contents node, it takes more time to do it by manually .
Expected scenario : If the content "Test" contains "SampleMacro" then we need to update the template of this content into another template .
Hi Thamodaran,
If memory serves then probably the best way to go about this is to use the ContentService to retrieve your content. If your template has already been created, then you should be able to use the FileService and
to retrieve the template and from there you can get the template Id and set it on your content via the TemplateId property.
Don't forget to either save or publish via the ContentService it for the changes to take affect!
is working on a reply...