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?
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 this.PublishChildDocs(parentDoc);
protectedvoid PublishChildDocs(Document doc)
{
doc.Publish(User.GetUser(0));
// loop through all child documents in the doc, recursively calling this methodforeach (Document childDoc in doc.Children)
{
PublishChildDocs(childDoc);
}
}
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.
Thanks
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 http://our.umbraco.org/wiki/reference/api-cheatsheet/difference-between-node-and-document.
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
this.PublishChildDocs(parentDoc);
Hi. Probably this will work:
Some drawback may be that the whole umbraco.config will be rebuilt, though.
is working on a reply...