Migrate from Escenic to EPiServer

A cli­ent of mine nee­ded help with con­ver­ting a site from Esce­nic to EPi­Ser­ver. I knew abso­lu­tely not­hing about Esce­nic, but after some rese­arch on the Inter­net, I found out that Esce­nic can export articles and rela­ted infor­ma­tion using XML files.

I asked the cli­ent to export a selec­tion of articles with rela­ted files, and from that I was able to cre­a­te an impor­ter for the XML files. And once I had that, it was a rela­ti­vely easy task to cre­a­te pages in EPi­Ser­ver and fill the pro­per­ti­es with infor­ma­tion from the artic­le fields in Esce­nics export files.

It was deci­ded that all pages should be cre­a­ted in EPi­ser­ver grou­ped after what type they were in Esce­nic. An artic­le of type ”stan­dard” will be cre­a­ted under a page with the name ”stan­dard”, etc. After migra­tion was com­ple­ted, the edi­tors would then move the pages to their final des­ti­na­tion, after chec­king that the impor­ted pages looked OK.

The migra­tor reads all infor­ma­tion from the XML files, and then does some LINQ magic to con­nect the articles with their sec­tions, refe­rences, rela­tions, and aut­hors. Refe­rences are refe­rences to media files, such as ima­ges or docu­ments. Rela­tions con­tain infor­ma­tion about rela­ted pages, such as links to other pages with rela­ted infor­ma­tion. Sec­tions are kind of like parent pages in EPi­Ser­ver, it con­trols in what sec­tions an artic­le is shown (an artic­le can belong to seve­ral sec­tions). And final­ly, Aut­hor con­tains infor­ma­tion about the author(s) of the artic­le.

After rea­ding the XML files, the migra­tor loops through all the impor­ted articles, and based on the artic­le type, a cor­re­spon­ding EPi­Ser­ver page type is cre­a­ted using PageTypeResolver.GetDefaultPageData(). Befo­re retur­ning the new (uns­a­ved) page, cer­tain com­mon infor­ma­tion (such as Page­Na­me, Start­Publish, and the page cre­a­tion date) is set.

The next step in the migra­tion pro­cess is to con­vert the fields of the artic­le to EPi­Ser­ver pro­per­ty values. The ”stan­dard” artic­le type had a lot of sequen­ti­al­ly named BODY fields (BODY1, BODY2, etc), with ima­ges some­ti­mes added between the fields (the refe­rence tag holds infor­ma­tion about which field it belongs to). The met­hods Article.ConstructHtmlForStandardSection() and Article.FormatPart() are respon­sib­le for assembling the­se fields, and then saving them to Main­Bo­dy of the page. Article.FormatPart() is also respon­sib­le for saving the atta­ched media files to the Uni­fi­ed File System.

After set­ting a couple of more pro­per­ti­es on the EPi­Ser­ver page, the page is final­ly saved to the data­ba­se, and the pro­cess con­ti­nues with the next artic­le, until eve­ryt­hing is migra­ted.

I’m not going to post any code in this post, but I am atta­ching a .7z file with a bunch of code you can use. The­re are some exten­sions met­hods and hel­per clas­ses which are a bit use­ful, they are also inclu­ded in the pro­ject.

I am using EPi­Ser­ver CMSR2, but it should be easy to modi­fy the code for ear­li­er or later ver­sions. The pro­ject is using .Net Fram­ework 4 and Visu­al Stu­dio 2012.

BTW, if you just want to brow­se the infor­ma­tion, the Par­se but­ton just reads the XML files from Esce­nic and dis­plays their con­tents in a structu­red way on the page. If you click on the ”Fields” link on the ren­de­red page, all fields will be shown.

And, as usu­al, I can not be held respon­sib­le for any bugs in the code, or damage cau­sed by run­ning it. You should adapt it to your own needs and test it tho­roughly befo­re run­ning it on a pro­duc­tion envi­ron­ment!! 🙂

Down­lo­ad EscenicMigrator.7z

If you find it use­ful or have any tips for changes, ple­a­se let me know! Con­structi­ve feed­back is always wel­come.

I’ve cre­a­ted a repo on git­hub with the code: https://github.com/PaddySe/EscenicMigrator