new Api - very similar - you just have to find the template based on id or alias
// connect to the contentTypeService
IContentTypeService _contentTypeService = ApplicationContext.Current.Services.ContentTypeService;
// get the docType
IContentType docType = _contentTypeService.GetContentType(id);
if (docType != null)
{
// get the template you want to set.
ITemplate template = ApplicationContext.Current.Services.FileService.GetTemplate("myTemplate");
if (template != null)
{
// set
docType.SetDefaultTemplate(template);
// save
_contentTypeService.Save(docType);
}
}
setting a default template for a document type in C#
how can i set a default template for a document type using c# code
If you're using the old API there is a property called DefaultTemplate on a DocumentType where you can set it.
Jeroen
new Api - very similar - you just have to find the template based on id or alias
thanks kevin
i tried it and its working fine
is working on a reply...