Jun 29, 2017
Nov 21, 2017
Closed, Fixed and tested
If a new content item is created with ImportContext, e.g.' by attaching an event handler to IDataImportEvents.ContentImported and then, in the event handler, something like this happens
var page = contentRepository.GetDefault<ContentFolder>(ContentReference.RootPage); page.Name = "something"; contentRepository.Save(page);
an exception is thrown PropertyDate is out of range. Example: [Importing content 6202_8055] Exception: You must enter a value between 01/01/1753 and 12/31/9999 for "EPiServer.Core.PropertyDate".
Note: This is because the DataImporter sets a context key ContextCache.Current[UseIChangeTrackingSavedKey]. When that is set, it does not set the saved date to DateTime.Now but instead uses the date from the content itself. This is so the content gets the same time at it has in import package. While this works for content in the package, if other content is created (e.g., from an event handler), it will fail. We should use DateTime.Now for those content items instead of throwing an exception.