Export ONLY Page Types

Kelly Kerns asked on July 25, 2016 22:46

I am attempting to create a zip file artifact containing all the Page types for a site. I want to do this programatically and am looking to build a utility that uses the Kentico API directly.

I see a way to export a site or to export objects using ExportProvider.ExportSite or ExportProvider.ExportObject.

If I use ExportSite I am assuming there is a way to setup a SiteExportSettings defining the PageTypes to export

If I use ExportObject I am guessing that I would need to iterate a list of PageTypes then run ExportObject for each.

I am not seeing a PageTypeProvider which would allow me to get the PageTypes.

Any help or example code would be greatly appreciated.

Thanks Kellyl

Recent Answers

Trevor Fayas answered on July 26, 2016 20:15

Kentico can do this through the Sites -> Export

Just make set "Do not preselect any objects", then on the left tree do

"All Objects" -> "Global Objects" -> "Development" -> Page Types, click on it then you can select all the page types you want!

0 votesVote for this answer Mark as a Correct answer

Kelly Kerns answered on July 26, 2016 22:02

Thanks Trevor; I guess I didn't state it explicitly, but I am trying to do this headless. I want to do it programatically so I can incorporate it into my release management process with a zip file containing all the page types that exist at any given point in my integration environment.

I then want to upload/import it into the next environment along the deployment path - ALSO programatically.

I've made some good progress using the CMS.CMSImportExport library and the ExportProvider.ExportObjectsData()

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on July 27, 2016 16:28 (last edited on July 27, 2016 16:28)

Ah apologies, haven't done much with the API to get object data and zip it, however there are some options.

  1. You can take a look at the REST services to get Object Data and zip it ( Documentation )
  2. The data (XML fragments) are all in the database, so you can use the Query API to get the information using a WHERE condition, then save that.
  3. There may be a way through the API directly to get the information, sadly i don't have the time to fully investigate :(

Hope some of these help some!

0 votesVote for this answer Mark as a Correct answer

Kelly Kerns answered on July 27, 2016 17:09

Thanks Trevor;

I got an export file using the API.
I'm now working on the Import. The file I created works when I import it manually through the ui!

However when I try to use the Import per the Documentation I am getting exceptions that have to do with Webfarm synchronization even though I don't have webfarms turned on.

Thanks again for taking time to answer. I think on I'm the right path.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.