Portal Engine
Version 2.x > Portal Engine > Change a page template through API View modes: 
User avatar
lengland@thefellowship.info - 11/28/2007 6:25:17 PM
Change a page template through API
I want to write a little console app in VS.net that will let me take a set of pages and assign them a different page template. For example, say I have

50 pages that use templateA
30 pages that use templateB

but I want to assign all 80 pages to use templateC.

I can write the SQL to get the pages, and I can get the PK of the new template. But I'm a little lost in the API. The psuedo code would be:

Get resultset of pageIDs
for each pageID in resultset
load page
set new page templateIDsave page

Any assistance would be greatly appreciated.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 1/8/2008 2:58:29 PM
RE:Change a page template through API
You can try to create a SQL query which will update the values in table CMS_Document in the column DocumentPageTemplateID to the ID of the template you want to use. The template ID must be present in CMS_PageTemplate table (please check also for other FK or PK dependencies).