Copied to clipboard

Flag this post as spam?

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


  • Martin Nielsen 7 posts 87 karma points
    Feb 19, 2016 @ 11:13
    Martin Nielsen
    0

    Created node cannot be retrieved until IIS reset

    When I create and publish a node and try to retrieve it again I get NULL:

    IContent created = cs.CreateContent("MyNode", parentNode.Id, "MyDocTypeAlias", 0);
    
    created.SetValue("MyProperty", "blah blah");
    
     cs.Save(created);
     cs.Publish(created);
    
    
    IPublishedContent node = parentNode.Children.Where(x => x.Name == "MyNode").FirstOrDefault(); // returns null !!
    

    So what am I missing...?

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Feb 19, 2016 @ 12:39
    Alex Skrypnyk
    0

    Hi Martin,

    Try to use this method for saving:

    ApplicationContext.Services.ContentService.SaveAndPublishWithStatus(node);
    

    Also is important to get parentNode and its children after Save and Publish.

    Thanks, Alex

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies