Error while importing data for property '', datasource record
Hi,
thank for the plugin.
I tried to import Standard Page Blog Post from csv file and plugin returns me
thi error
Error while importing data for property '', datasource record
This is log file
2020-02-05 10:36:47,945 [P716/D26/T9] ERROR CMSImportLibrary.Providers.ImportProviders.Content.ContentImportProvider - CMSImport:A record failed to import for alias
System.NullReferenceException: Object reference not set to an instance of an object.
at USN.USNBusinessLogic.USNRegisterEvents.ContentService_Saving(IContentService sender, SaveEventArgs1 e) in C:\inetpub\wwwroot\sitename\src\Umbraco.Web.UI\App_Code\USNBusinessLogic\USNRegisterEvents.cs:line 163
at Umbraco.Core.Events.ScopeEventDispatcherBase.DispatchCancelable[TSender,TArgs](TypedEventHandler2 eventHandler, TSender sender, TArgs args, String eventName) in \server\wwwroot\sitename\src\Umbraco.Core\Events\ScopeEventDispatcherBase.cs:line 53
at Umbraco.Core.Services.ContentService.Save(IContent content, Boolean changeState, Int32 userId, Boolean raiseEvents) in \server\wwwroot\sitename\src\Umbraco.Core\Services\ContentService.cs:line 2611
at Umbraco.Core.Services.ContentService.Umbraco.Core.Services.IContentServiceOperations.Save(IContent content, Int32 userId, Boolean raiseEvents) in \server\wwwroot\sitename\src\Umbraco.Core\Services\ContentService.cs:line 1529
at Umbraco.Core.Services.ContentService.Save(IContent content, Int32 userId, Boolean raiseEvents) in \server\wwwroot\sitename\src\Umbraco.Core\Services\ContentService.cs:line 1387
at CMSImportLibrary.Providers.ImportProviders.Content.ContentImportProvider.(ImportState , Int32 , ImportStatistics , String )
If i set newsItemDate with this manually value
DateTime newsItemDate = DateTime.Parse("01/01/2000");
plugin executes the import without errors, but obviously create the folder "2000" and "January". If i want import post in correctly folder date, which node.GetValue parameter should I use?
Error while importing data for property '', datasource record
Hi, thank for the plugin. I tried to import Standard Page Blog Post from csv file and plugin returns me thi error Error while importing data for property '', datasource record
This is log file
2020-02-05 10:36:47,945 [P716/D26/T9] ERROR CMSImportLibrary.Providers.ImportProviders.Content.ContentImportProvider - CMSImport:A record failed to import for alias System.NullReferenceException: Object reference not set to an instance of an object. at USN.USNBusinessLogic.USNRegisterEvents.ContentService_Saving(IContentService sender, SaveEventArgs
1 e) in C:\inetpub\wwwroot\sitename\src\Umbraco.Web.UI\App_Code\USNBusinessLogic\USNRegisterEvents.cs:line 163 at Umbraco.Core.Events.ScopeEventDispatcherBase.DispatchCancelable[TSender,TArgs](TypedEventHandler
2 eventHandler, TSender sender, TArgs args, String eventName) in \server\wwwroot\sitename\src\Umbraco.Core\Events\ScopeEventDispatcherBase.cs:line 53 at Umbraco.Core.Services.ContentService.Save(IContent content, Boolean changeState, Int32 userId, Boolean raiseEvents) in \server\wwwroot\sitename\src\Umbraco.Core\Services\ContentService.cs:line 2611 at Umbraco.Core.Services.ContentService.Umbraco.Core.Services.IContentServiceOperations.Save(IContent content, Int32 userId, Boolean raiseEvents) in \server\wwwroot\sitename\src\Umbraco.Core\Services\ContentService.cs:line 1529 at Umbraco.Core.Services.ContentService.Save(IContent content, Int32 userId, Boolean raiseEvents) in \server\wwwroot\sitename\src\Umbraco.Core\Services\ContentService.cs:line 1387 at CMSImportLibrary.Providers.ImportProviders.Content.ContentImportProvider.(ImportState , Int32 , ImportStatistics , String )Best regards
Hi,
The error is coming from your Save event in your USNRegisterEvents, maybe fix it there?
Best,
Richard
Hi Richard, thank you for reply. If i insert a new post i haven't problem. Can you help me to find error?
thank you
You should add a Breakpoint in that class and run the import to see what is happening, Maybe you are missing a property?
Best,
Richard
Hi, Richard thank you
the error is in USNRegisterEvents.cs line 163
DateTime newsItemDate = DateTime.Parse(node.GetValue("postDate").ToString());
System.NullReferenceException: 'Reference to an object not set on an object instance.'
Umbraco.Core.Models.IContentBase.GetValue(...) returned null.
Ok so you can fix it there.
If i set newsItemDate with this manually value DateTime newsItemDate = DateTime.Parse("01/01/2000"); plugin executes the import without errors, but obviously create the folder "2000" and "January". If i want import post in correctly folder date, which node.GetValue parameter should I use?
Hi all, finally i solved problem. I changed USNRegisterEvents.cs line 163
DateTime newsItemDate = DateTime.Parse(node.CreateDate.ToString());
Thank you all
is working on a reply...