Get Template IDs

Get Template IDs

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Data.Items.Item
  • Sitecore.StringUtil
  • Sitecore.TemplateIDs

Template IDs C# Web Control Code

Sitecore.Data.Items.Item item = this.GetItem();
if (item == null) return;

string alias = Sitecore.TemplateIDs.Alias.ToString();
string application = Sitecore.TemplateIDs.Application.ToString();
string archivedItem = Sitecore.TemplateIDs.ArchivedItem.ToString();
string branchTemplate = Sitecore.TemplateIDs.BranchTemplate.ToString();
string branchTmpltFldr = Sitecore.TemplateIDs.BranchTemplateFolder.ToString();
string command = Sitecore.TemplateIDs.Command.ToString();
string commandGroup = Sitecore.TemplateIDs.CommandGroup.ToString();
string commandMaster = Sitecore.TemplateIDs.CommandMaster.ToString();
string device = Sitecore.TemplateIDs.Device.ToString();
string dictEntry = Sitecore.TemplateIDs.DictionaryEntry.ToString();
string domain = Sitecore.TemplateIDs.Domain.ToString();
string dynamicMaster = Sitecore.TemplateIDs.DynamicMaster.ToString();
string file = Sitecore.TemplateIDs.File.ToString();
string folder = Sitecore.TemplateIDs.Folder.ToString();
string image = Sitecore.TemplateIDs.Image.ToString();
string language = Sitecore.TemplateIDs.Language.ToString();
string layout = Sitecore.TemplateIDs.Layout.ToString();
string layoutGroup = Sitecore.TemplateIDs.LayoutGroup.ToString();
string linkedDB = Sitecore.TemplateIDs.LinkedDatabase.ToString();
string mainSection = Sitecore.TemplateIDs.MainSection.ToString();
string mediaFolder = Sitecore.TemplateIDs.MediaFolder.ToString();
string menuDivider = Sitecore.TemplateIDs.MenuDivider.ToString();
string menuItem = Sitecore.TemplateIDs.MenuItem.ToString();
string node = Sitecore.TemplateIDs.Node.ToString();
string packageReg = Sitecore.TemplateIDs.PackageRegistration.ToString();
string property = Sitecore.TemplateIDs.Property.ToString();
string proxy = Sitecore.TemplateIDs.Proxy.ToString();
string reference = Sitecore.TemplateIDs.Reference.ToString();
string renderingGroup = Sitecore.TemplateIDs.RenderingGroup.ToString();
string role = Sitecore.TemplateIDs.Role.ToString();
string schedule = Sitecore.TemplateIDs.Schedule.ToString();
string stndTemplate = Sitecore.TemplateIDs.StandardTemplate.ToString();
string sublayout = Sitecore.TemplateIDs.Sublayout.ToString();
string template = Sitecore.TemplateIDs.Template.ToString();
string tmpltField = Sitecore.TemplateIDs.TemplateField.ToString();
string tmpltFldType = Sitecore.TemplateIDs.TemplateFieldType.ToString();
string tmpltFolder = Sitecore.TemplateIDs.TemplateFolder.ToString();
string tmpltSection = Sitecore.TemplateIDs.TemplateSection.ToString();
string unverImage = Sitecore.TemplateIDs.UnversionedImage.ToString();
string user = Sitecore.TemplateIDs.User.ToString();
string verImage = Sitecore.TemplateIDs.VersionedImage.ToString();
string workflow = Sitecore.TemplateIDs.Workflow.ToString();
string workflowCmd = Sitecore.TemplateIDs.WorkflowCommand.ToString();
string workflowState = Sitecore.TemplateIDs.WorkflowState.ToString();
string xmlLayout = Sitecore.TemplateIDs.XMLLayout.ToString();
string xslRendering = Sitecore.TemplateIDs.XSLRendering.ToString();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("C# Web Control Real-time Output");
output.RenderEndTag();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
string displayName = Sitecore.StringUtil.GetString(item.DisplayName, item.Name);
//using : for colon and   for space
output.Write("{0}: {1}", "Item", displayName);
output.RenderEndTag(); //P

output.Write("{0}&#58;&#160;{1}", "Alias", "<b>" + alias + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Application", "<b>" + application + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Archived Item", "<b>" + archivedItem + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Branch Template", "<b>" + branchTemplate + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Branch Template Folder", "<b>" + branchTmpltFldr + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Command", "<b>" + command + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Command Group", "<b>" + commandGroup + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Command Master", "<b>" + commandMaster + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Dictionary Entry", "<b>" + dictEntry + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Domain", "<b>" + domain + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Dynamic Master", "<b>" + dynamicMaster + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "File", "<b>" + file + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Folder", "<b>" + folder + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Image", "<b>" + image + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Language", "<b>" + language + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Layout", "<b>" + layout + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Layout Group", "<b>" + layoutGroup + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Linked Database", "<b>" + linkedDB + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Main Section", "<b>" + mainSection + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Media Folder", "<b>" + mediaFolder + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Menu Divider", "<b>" + menuDivider + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Menu Item", "<b>" + menuItem + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Node", "<b>" + node + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Package Registration", "<b>" + packageReg + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Property", "<b>" + property + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Proxy", "<b>" + proxy + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Reference", "<b>" + reference + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Rendering Group", "<b>" + renderingGroup + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Role", "<b>" + role + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Schedule", "<b>" + schedule + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Standard Template", "<b>" + stndTemplate + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Sublayout", "<b>" + sublayout + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Template", "<b>" + template + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Template Field", "<b>" + tmpltField + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Template Field Type", "<b>" + tmpltFldType + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Template Folder", "<b>" + tmpltFolder + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Template Section", "<b>" + tmpltSection + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Unversioned Image", "<b>" + unverImage + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "User", "<b>" + user + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Versioned Image", "<b>" + verImage + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Workflow", "<b>" + workflow + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Workflow Command", "<b>" + workflowCmd + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Workflow State", "<b>" + workflowState + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "XML Layout", "<b>" + xmlLayout + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "XSL Rendering", "<b>" + xslRendering + "</b>");

output.RenderEndTag(); //Div


Template IDs C# Web Control Output

Alias: {54BCFFB7-8F46-4948-AE74-DA5B6B5AFA86}
Application: {EB06CEC0-5E2D-4DC4-875B-01ADCC577D13}
Archived Item: {BF2B8DA2-3CBA-485D-8F85-3788B8AFBDBF}
Branch Template: {35E75C72-4985-4E09-88C3-0EAC6CD1E64F}
Branch Template Folder: {85ADBF5B-E836-4932-A333-FE0F9FA1ED1E}
Command: {A66F4A32-23A6-4AC3-AB14-84F383C5F3BA}
Command Group: {FBDD7D4F-3300-4432-9CB1-FDAD551DDD5E}
Command Master: {B2613CC1-A748-46A3-A0DB-3774574BD339}
Dictionary Entry: {6D1CD897-1936-4A3A-A511-289A94C2A7B1}
Domain: {438F33BA-504D-4EFB-BE78-42B98603A7E8}
Dynamic Master: {B4D19D07-B3EB-4F7D-98EC-8BCB41CCC58E}
File: {611933AC-CE0C-4DDC-9683-F830232DB150}
Folder: {A87A00B1-E6DB-45AB-8B54-636FEC3B5523}
Image: {C97BA923-8009-4858-BDD5-D8BE5FCCECF7}
Language: {F68F13A6-3395-426A-B9A1-FA2DC60D94EB}
Layout: {3A45A723-64EE-4919-9D41-02FD40FD1466}
Layout Group: {85B7F5D9-6F3A-4AD1-B218-D9FBE1DF8BB3}
Linked Database: {2085BFB3-1371-4092-BF06-32EF5849ED87}
Main Section: {E3E2D58C-DF95-4230-ADC9-279924CECE84}
Media Folder: {FE5DD826-48C6-436D-B87A-7C4210C7413B}
Menu Divider: {35753BF3-8A94-4DA6-A5D7-DBD945D1AA59}
Menu Item: {998B965E-6AB8-4568-810F-8101D60D0CC3}
Node: {239F9CF4-E5A0-44E0-B342-0F32CD4C6D8B}
Package Registration: {22A11D20-5F1D-4216-BF3F-18C016F1F98E}
Property: {97D75760-CF8B-4740-810B-7727B564EF4D}
Proxy: {CB3942DC-CBBA-4332-A7FB-C4E4204C538A}
Reference: {EF295CD8-19D4-4E02-9438-94C926EF5284}
Rendering Group: {4B8AD536-4FA6-4122-A31E-32BB6BC42806}
Role: {A7DF04B4-4C4B-44B7-BE1E-AD901BD53DAD}
Schedule: {70244923-FA84-477C-8CBD-62F39642C42B}
Standard Template: {1930BBEB-7805-471A-A3BE-4858AC7CF696}
Sublayout: {0A98E368-CDB9-4E1E-927C-8E0C24A003FB}
Template: {AB86861A-6030-46C5-B394-E8F99E8B87DB}
Template Field: {455A3E98-A627-4B40-8035-E683A0331AC7}
Template Field Type: {F8A17D6A-118E-4CD7-B5F5-88FF37A4F237}
Template Folder: {0437FEE2-44C9-46A6-ABE9-28858D9FEE8C}
Template Section: {E269FBB5-3750-427A-9149-7AA950B49301}
Unversioned Image: {F1828A2C-7E5D-4BBD-98CA-320474871548}
User: {642C9A7E-EE31-4979-86F0-39F338C10AFB}
Versioned Image: {C97BA923-8009-4858-BDD5-D8BE5FCCECF7}
Workflow: {1C0ACC50-37BE-4742-B43C-96A07A7410A5}
Workflow Command: {CB01F9FC-C187-46B3-AB0B-97A8468D8303}
Workflow State: {4B7E2DA9-DE43-4C83-88C3-02F042031D04}
XML Layout: {1163DA83-B2EF-4381-BF09-B2FF714B1B3F}
XSL Rendering: {F1F1D639-4F54-40C2-8BE0-81266B392CEB}