This is because the sender is null in Umbraco since v7.x It should only be null with new items.
However, when I'm using Umbraco v7.7.9 with CMSImport v3.5.3 the "sender" property is not a null but a proper IContent object.
And for us it's very convenient because "RecordImporting" had sender as an "IContent" object which is not yet published, it's properties can be easily changed, and they will be saved during "ContentService.Saving" event.
I have tried to create an artificial field with data and an artificial mapping for this field:
e.Items.Add("artificialField", someData);
e.ImportState.Mapping.Add("IContentProperty", "artificialField");
But it made things much worse - after two or more runs, "RecordImporting" remember the mapping but it's DataProvider become null. And "ContentService.Saved" is triggered before the value is mapped to the property.
Therefore I have abandoned this idea.
Eventually, We had to revert all changes from v3.7.3 back to the v3.5.3 due to this breaking change.
Do I understand correctly that v3.5.3 use obsolete Umbraco's methods and that's why we are getting "null" as an object for new content and this new functionality is set in stone and you don't plan to change it back?
RecordImportingEventHandler has null as 'sender'
Hello,
We have updated CMSImport package from v3.5.3 to v3.7.4 and we got the issue during "RecordImporting" Event. The sender comes as "null"
We are using it quite active there. Was it removed deliberately, because I haven't found anything of the sort in the Release Notes?
Thank you
Hi,
This is because the sender is null in Umbraco since v7.x It should only be null with new items.
Hope this helps a bit.
Best,
Richard
Hello Richard,
However, when I'm using Umbraco v7.7.9 with CMSImport v3.5.3 the "sender" property is not a null but a proper IContent object. And for us it's very convenient because "RecordImporting" had sender as an "IContent" object which is not yet published, it's properties can be easily changed, and they will be saved during "ContentService.Saving" event.
I have tried to create an artificial field with data and an artificial mapping for this field: e.Items.Add("artificialField", someData); e.ImportState.Mapping.Add("IContentProperty", "artificialField"); But it made things much worse - after two or more runs, "RecordImporting" remember the mapping but it's DataProvider become null. And "ContentService.Saved" is triggered before the value is mapped to the property. Therefore I have abandoned this idea.
Eventually, We had to revert all changes from v3.7.3 back to the v3.5.3 due to this breaking change. Do I understand correctly that v3.5.3 use obsolete Umbraco's methods and that's why we are getting "null" as an object for new content and this new functionality is set in stone and you don't plan to change it back?
Thank you
is working on a reply...