IndieTech Solutions
IndieTech Solutions

Reputation: 2541

Content migration error from Ektron to EpiServer

I am working on a content migration project , from Ektron 9 to EpiServer 8, the first task is to migrate the content of specific pages , to achieve that, I was following Ektron's API guidance Ektron Developer API

1- I am approaching this migration the right way? right now I just added Ektron Dll as a reference in my app. I tried to use their web services , but it doesn't have the data i need (content of specific pages).Ektron Web Services

here's a snippet of my code:

   GetAllTemplatesRequest cc = new GetAllTemplatesRequest();
            //var UserCRUD = new Ektron.Cms.Framework.User.UserManager();
            var UserCRUD = new UserManager();
            string Token = UserCRUD.Authenticate("admin", "password");
            if (!string.IsNullOrEmpty(Token)) // Success
            {
             try
            {
                //Create the Content Object set to observe permissions
                Ektron.Cms.Framework.Content.ContentManager ContentAPI
                  = new      Ektron.Cms.Framework.Content.ContentManager(ApiAccessMode.Admin);
                //Retrieve the content
                Ektron.Cms.ContentData contentData;
                contentData = ContentAPI.GetItem(30);
                //Output the retrieved item's content
                var cs = contentData.Html;
            }
            catch (Exception _e)
            {
                throw _e;
            }
            }
            else // Fail
            {

            }

But I am getting this error:Error

Upvotes: 0

Views: 449

Answers (3)

IndieTech Solutions
IndieTech Solutions

Reputation: 2541

This is what i ended up doing : As there are many ways to perform the migration , I chose the approach of focusing mainly on EpiServer APIs to create new content , blocks, and assets ; and get all the content i need from Ektron using SQL statements.

Ektron Save all the content in a table named content .

The pages are organized in “Folder structure” fashion , so every page is in a “Folder”

to get the folder ID for a specific page, you can use this query :

select folder_id from content  where content_id = 2147485807

with that folder id you can get all the pages listed under that specific folder; for instance you will need to get all the pages under “Articles”.

Then i used that folderID in this query:

SELECT [content_id]
,[content_title]
,[content_html]
,[date_created]
,folder_id
,[content_teaser]
,[content_text]
,[end_date]
,[content_type]
,[template_id]
, content_status
FROM content
where folder_id=(select folder_id from content  where content_id = 2147485807)
order by content_title
FOR XML PATH(‘Article’), ROOT (‘Articles’)

which Creates an XML for me ready to consume in my EpiServer code.

The first thing in EPI server I did is to add a new property in the SitePageBase model to add a “LegacyContentID” that will serve as a mapping entry in case i need to access/modify the content of the new created pages. it serves as a link between the data imported from Ektron and the new data i am creating on EPI server.

[Display(
Name = “Legacy Content ID”,
Description = “Content ID from Ektron imported data , for migration purposes”,
GroupName = GroupNames.PageSettings,
Order = 37)]
[ScaffoldColumn(false)]
[Editable(false)]
public virtual string LegacyContentID { get; set; }

Then i created a method to create the article pages , the only parameter it needs is the parentID from IP server (you can create a new page in EpiServer and then under properties of that page you can the page ID).

     public void CreateArticlesPages(int parentID)
{

IContentRepository contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();

var parentlink = new ContentReference(parentID);
XmlDocument doc = new XmlDocument();
doc.LoadXml(File.ReadAllText(@”Articles.xml”));
string jsonText = JsonConvert.SerializeXmlNode(doc);
dynamic data = JsonConvert.DeserializeObject(jsonText);

for (int i = 0; i < data.Articles.Article.Count; i++)
{
var PageImportedObject = data.Articles.Article[i];
ArticlePage page = contentRepository.GetDefault<ArticlePage>(parentlink);

page = contentRepository.GetDefault<ArticlePage>(parentlink);
page.LegacyContentID = PageImportedObject.content_id;
page.Name = PageImportedObject.content_title;
page.PageTitle = PageImportedObject.content_title;

if (PageImportedObject.content_teaser == null)
page.Summary = “No Summary from the Ektron DB”;
else
page.Summary = PageImportedObject.content_teaser;
page.Description = PageImportedObject.content_html.root.Description;

contentRepository.Save(page, EPiServer.DataAccess.SaveAction.Save, EPiServer.Security.AccessLevel.NoAccess);
contentRepository.Save(page, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);

}
}

The code above creates a new page of type “ArticlePage” and add content from the XML generated earlier holding Ektron’s info.

Upvotes: 1

Lance
Lance

Reputation: 178

You will want to review the content migration starter kit. https://github.com/egandalf/ContentTransferStarterKit

Upvotes: 0

maddoxej
maddoxej

Reputation: 1662

Just coping one dll from an Ektron site into another site will not work.

The Web services idea was a better one. There are web service calls to get the content by id.

Alternatively you could write your own web service that runs inside the ektron site and uses the Ektron API to expose the data you want. Then call that service from the other site.

Upvotes: 0

Related Questions