Copied to clipboard

Flag this post as spam?

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

  • deldongdong 11 posts 26 karma points
    Mar 15, 2012 @ 04:14

    how to publish with all unpublished sub nodes?

    i found that publishWithSubs method just can publish first level nodes of the parent node.

    how can i publish all the unpublished nodes under one parent node? no matter how deepth the unpublished nodes are.



  • Ian Robinson 79 posts 143 karma points
    Mar 15, 2012 @ 17:19
    Ian Robinson

    I'm not familiar with the "publishWithSubs" method but could you loop through the children of the parent document instead and recursively publish every child document?  

    I say "Document" instead of "Node" because I think only a document can be published, a node is already a published version of the underlying document, see

    For example you could have a method that calls itself, once you call it initially on your parent document.  Something like:

    // get a document version of your node
    Document parentDoc = new Document(node.Id);

    // where parentDoc is your parent Document
    protected void PublishChildDocs(Document doc)
             // loop through all child documents in the doc, recursively calling this method
             foreach (Document childDoc in doc.Children)



  • Rodion Novoselov 694 posts 859 karma points
    Mar 15, 2012 @ 20:52
    Rodion Novoselov

    Hi. Probably this will work:


    Some drawback may be that the whole umbraco.config will be rebuilt, though.

Please Sign in or register to post replies

Write your reply to: