0

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...

cganickel
  • 76
  • 6

1 Answers1

1

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.

Michal Samuhel
  • 511
  • 3
  • 4
  • 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. – cganickel Dec 04 '19 at 15:41