Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Document type api View modes: 
User avatar
Member
Member
seanbun - 2/18/2010 9:47:30 PM
   
Document type api
Hi,

Does anyone know how to get the document type infomation from api?

e.g. what is the default page template? what are the site included...

Cheers,
Matt
@seanbun

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 2/19/2010 6:58:09 AM
   
RE:Document type api
Hello,

You can use the following code to get the temlate ID:

CMS.DataEngine.GeneralConnection conn = CMS.DataEngine.ConnectionHelper.GetConnection();
CMS.DataEngine.ClassStructureInfo SI = CMS.DataEngine.ClassStructureInfo.GetClassInfo("cms.document", conn);
Literal1.Text =SI.DataClassInfo.ClassDefaultPageTemplateID.ToString();


The string "cms.document" is the code name of the document type.

Best regards,
Boris Pocatko

User avatar
Member
Member
seanbun - 2/21/2010 9:19:33 PM
   
RE:Document type api
Thanks Boris,

The code works really well. It is good to know the ClassStructureInfo class which is very useful.

What I am doing is I have already set a default page template for my custom document type. However, I realised the new documents do not pick up the default template sometimes. Now, I put the code you provide in the CustomEventHandler which ensure the template would be applied to the document.

Cheers,
Matt

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 2/22/2010 3:36:18 AM
   
RE:Document type api
Hello,

I am glad I could help. Have a nice day.

Best regards,
Boris Pocatko