By cganickel

2019-12-02 23:04:12 8 Comments

I've created a number of .iprofile files to import pages from a legacy WebForms site into the "Content-Only" versions on a new MVC site. This works great except that it ignores the mapping for DocumentCreatedWhen and DocumentModifiedWhen. Each time the import occurs without errors but the Created and Modified dates in the MVC site are the date/time of the import, not the original date and time.

I've tried using the GUI version of the Import Toolkit and the command-line version, I've verified that there are mapping elements in the .iprofile files for DocumentCreatedWhen and DocumentModifiedWhen, like so:

<mapping target="documentcreatedwhen" source="DocumentCreatedWhen" />
<mapping target="documentmodifiedwhen" source="DocumentModifiedWhen" />

Does this work with the Kentico Import Toolkit or will I need to use a different mechanism?

Edited title to use correct field names...


@Michal Samuhel 2019-12-03 09:35:24

Unfortunately, both values are set when an object is created and/or modified and both these properties have internal setters so basically from your perspective are just read-only. Onehack around it would be to change system clock as they rely on DateTime.Now; and another would be to actually convince framework with your own implementation of DateTime

Last and easiest approach would be to import data and than run SQL to adjust modified fields directly.

@cganickel 2019-12-04 15:41:07

That is unfortunate, I was hoping that this was simply a bug or missing feature in the import toolkit. The mappings for DocumentCreatedWhen and DocumentModifiedWhen shouldn't be options in the toolkit if they are ignored. I think I'll use your suggestion to import and then run SQL to adjust values, I'll create custom Created and Modified dates to get the original values, then run SQL to change the dates.

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] How to Create an MVC Widget in Kentico 12 Page Builder

4 Answered Questions

2 Answered Questions

2 Answered Questions

How to route and resolve pages in Kentico

1 Answered Questions

1 Answered Questions

How to use the Email template in c#code in kentico 10

1 Answered Questions

2 Answered Questions

3 Answered Questions

[SOLVED] ERROR: Error importing 'System tables' objects (Ecommerce - SKU) in Kentico

  • 2013-05-07 21:45:03
  • Kirsten Greed
  • 685 View
  • 0 Score
  • 3 Answer
  • Tags:   sql-server kentico

Sponsored Content