Documentation > CMS Template API Library > Asset > CreateTemplate(String,Asset)
CreateTemplate
Create a template with the given label in the given location. It can be created in template folder.
public CrownPeak.CMSAPI.Asset CreateTemplate(String,Asset)
Returns
A newly created template.
Parameters
Name | Description | Type |
---|---|---|
label | The label to use | System.String |
parent | The folder where the template is to be created. Must be a template folder. | CrownPeak.CMSAPI.Asset |
Code Example
C#
Sample:
string label = "Template Name"; Asset parent = Asset.Load("/_CPTest/Project/Templates/"); if(parent.IsLoaded) { Asset newTemplate = Asset.CreateTemplate(label, parent); if(newTemplate.IsLoaded) { // Do Something } }