Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I create document type and template, don't know how to assign "TestTemplate" to "Test" document type.
DocumentType dt = DocumentType.MakeNew(user, "Test"); Template t = Template.MakeNew("TestTemplate", user); dt.Save();
thanks.
Hi jeevan,
You may assign value to dt.DefaultTemplate or dt.allowedTemplates.
Hope this helps
Pnima
hi, pasang, thanks for reply.
DefaultTemplate can have only one. if you want to assign more than one template using api how do you assign?
dt.allowedTemplates requires collection of Templates. i.e Templates[]
how do you pass that collection of Templates.
You should be able to do it like this:
umbraco.cms.businesslogic.template.Template[] templates = new umbraco.cms.businesslogic.template.Template[2]; templates[0] = new umbraco.cms.businesslogic.template.Template(234); templates[1] = new umbraco.cms.businesslogic.template.Template(456); dt.allowedTemplates = templates;
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
how to relate/assign template to document using api
I create document type and template, don't know how to assign "TestTemplate" to "Test" document type.
DocumentType dt = DocumentType.MakeNew(user, "Test");
Template t = Template.MakeNew("TestTemplate", user);
dt.Save();
thanks.
Hi jeevan,
You may assign value to dt.DefaultTemplate or dt.allowedTemplates.
Hope this helps
Pnima
hi, pasang, thanks for reply.
DefaultTemplate can have only one. if you want to assign more than one template using api how do you assign?
dt.allowedTemplates requires collection of Templates. i.e Templates[]
how do you pass that collection of Templates.
hi, pasang, thanks for reply.
DefaultTemplate can have only one. if you want to assign more than one template using api how do you assign?
dt.allowedTemplates requires collection of Templates. i.e Templates[]
how do you pass that collection of Templates.
You should be able to do it like this:
is working on a reply...