Saving content via contentService throws exception
I'm trying to import some data into umbraco using the ContentService. The project is a console app and I'm using the ConsoleApplicationBase from the Umbconsole example app here: https://github.com/sitereactor/umbraco-console-example
I can retrieve content without issues using
contentService.GetById(1269);
However, when I try to add content via smth like
var content = contentService.CreateContent("title", 1052, "NewsItem", 0); contentService.Save(content);
an "Object reference not set to an instance of an object." exception is thrown.
From the last bit of the stack trace it appears something fails when umbraco is trying to load a setting, but there is no clue as to which one.
at Umbraco.Core.Configuration.UmbracoSettings.GetKey(String key) at Umbraco.Core.Configuration.UmbracoSettings.GetKeyValue(String key, Boolean defaultValue) at Umbraco.Core.Configuration.UmbracoSettings.get_UseLegacyXmlSchema() at Umbraco.Core.Services.PackagingService.Export(IContent content, Boolean deep) at Umbraco.Core.Models.ContentExtensions.ToXml(IContent content)
So. How do I get this working? I have tried enabling webservices in umbracoSettings.config. Same difference :-/
Saving content via contentService throws exception
I'm trying to import some data into umbraco using the ContentService.
The project is a console app and I'm using the ConsoleApplicationBase from the Umbconsole example app here:
https://github.com/sitereactor/umbraco-console-example
I can retrieve content without issues using
However, when I try to add content via smth like
an "Object reference not set to an instance of an object." exception is thrown.
From the last bit of the stack trace it appears something fails when umbraco is trying to load a setting, but there is no clue as to which one.
So. How do I get this working?
I have tried enabling webservices in umbracoSettings.config. Same difference :-/
Hello,
You can find the answer in this topic: http://our.umbraco.org/forum/developers/api-questions/39164-Console-Application-Publishing-Problem?p=0#comment142938
Jeroen
Ah! So the content is created alright. It's just the publishing that fails.
Wonder how I missed this :-/ Thanks a lot!
is working on a reply...