sitecore

Templates

Get Sitecore Template Item by ID

To get template item by template Id.

TemplateItem templateItem = Sitecore.Context.Database.GetTemplate(new ID("{11111111-1111-1111-1111-111111111111}"));

Get Sitecore Template Item by name

Input the name of the template to get the template by using GetTemplate Method.

TemplateItem templateItem = Sitecore.Context.Database.GetTemplate("NameOfTheTemplate");

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow