Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michael 2 posts 32 karma points
    Dec 08, 2013 @ 19:20
    Michael
    0

    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 :-/

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Dec 09, 2013 @ 12:11
  • Michael 2 posts 32 karma points
    Dec 09, 2013 @ 15:38
    Michael
    0

    Ah! So the content is created alright. It's just the publishing that fails.

    Wonder how I missed this :-/ Thanks a lot!

Please Sign in or register to post replies

Write your reply to:

Draft