Copied to clipboard

Flag this post as spam?

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


  • Anders Schmidt 76 posts 207 karma points
    Dec 02, 2013 @ 13:48
    Anders Schmidt
    0

    Publish node from session with razor.

    Hi,

    I have created a node on another page. Now moving to another page with session of node.

    Can anyone help me finish this. What am i doing wrong?

    <umbraco:Macro runat="server" language="cshtml">
        @{ var node = Session["node"];
                <p>@node</p>
    
                node.Publish(userAdmin);
                library.UpdateDocumentCache(node.Id);
                }                                       umbraco:Macro>
    Tkanks :-)

     

     

     

  • Anders Schmidt 76 posts 207 karma points
    Dec 02, 2013 @ 23:07
    Anders Schmidt
    100

    Got it working:

    @{
    
    var _alreadyCreatedId = Session["recentnodeId"];
    var id = _alreadyCreatedId.ToString().AsInt();
    
    var Node = new Document(id);
    var userAdmin = new User(0);
    
    Node.Publish(userAdmin);
    library.UpdateDocumentCache(Node.Id);
    
    }
Please Sign in or register to post replies

Write your reply to:

Draft