Copied to clipboard

Flag this post as spam?

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


  • Carsten Andersen 9 posts 78 karma points
    Jun 03, 2019 @ 13:17
    Carsten Andersen
    0

    Publish Icontent

    I'm not sure if I just missed it, but I can't seem to find a way to publish my Icontent from C#.

    I tried following this doc, but publish and SaveAndPublishWithStatus are missing.

    Current I've managed to save the Content with contentService.Save(child); but how can I publish it?

  • Mario Lopez 168 posts 958 karma points MVP 4x c-trib
    Jun 04, 2019 @ 11:15
    Mario Lopez
    0

    If you are in one of the Umbraco controllers (Surface, Mvc or Api controller) you should be able to do this:

    var node = Services.ContentService.Create("name", parentId, contentTypeAlias);
    
    node.SetValue("myProperty", "someValue");
    Services.ContentService.SaveAndPublish(node);
    

    The docs you are checking are from V7 anyways.

  • Carsten Andersen 9 posts 78 karma points
    Jun 07, 2019 @ 06:15
    Carsten Andersen
    0

    Thanks for your answer Mario,

    I'm not using this in a controller, but together with Hangfire to run some scheduled tasks.

Please Sign in or register to post replies

Write your reply to:

Draft