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 6133 posts 23952 karma points MVP 7x 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

Please Sign in or register to post replies

Write your reply to:

Draft