In addition to the document.UnPublish, try umbraco.library.UnPublishSingleNode(documentId). I think that's all you need, but if that's not enough try also umbraco.library.RefreshContent()
The umbraco.library.RefreshContent() didn't resolve the issue but looping through the nodes that shouldn't be published and applying document.UnPublish(id) then umbraco.library.RefreshContent() fixed the issue.
For anyone who runs into this:
Node node = new Node(1234);
foreach (Node letter in node.Children)
{
foreach (Node n in letter.Children)
{
if (n.GetProperty("file").Value == "") //testing, if met these nodes shouldn't be published
{
umbraco.library.UnPublishSingleNode(n.Id);
}
}
}
umbraco.library.RefreshContent();
umbraco.NodeFactory.Node.Children returning unpublished nodes 4.7.1.1
Hi I'm running 4.7.1.1.
I unpublished a number of documents using umbraco.cms.businesslogic.web.Document:
Now the following code is returning unpublished nodes (from above):
I think the issue is my xml cache, is there a way to force the xml to rebuild?
Thanks in advance.
Hi James,
In addition to the document.UnPublish, try umbraco.library.UnPublishSingleNode(documentId). I think that's all you need, but if that's not enough try also umbraco.library.RefreshContent()
Check this wiki for more info: Unpublish a document
-Tom
Hi Tom, thanks for the reply, that fixed it!
The umbraco.library.RefreshContent() didn't resolve the issue but looping through the nodes that shouldn't be published and applying document.UnPublish(id) then umbraco.library.RefreshContent() fixed the issue.
For anyone who runs into this:
is working on a reply...