This concerns a site running Umbraco 4.6.2, IIS 7 and .NET 4
Examples on Unpublishing/Deleting nodes often uses code like the following:
var doc = new Document(id);
doc.Unpublish();
umbraco.library.UpdateDocumentCache(doc.Id);
doc.delete(true);
Which seems to work fine when looking at things in the backend afterwards. But pages in frontend seems to ignore this when listing pages using xslt or umbraco.NodeFactory.Node.ChildrenAsList, which indicates it's a caching problem.
So my question is - how comes library.UpdateDocumentCache doesn't help here? It does exactly what it's supposed to do when creating publishing documents. Also I noticed that the following code works perfectly:
var doc = new Document(id);
umbraco.library.UnPublishSingleNode(id);
doc.delete(true);
Notice that there's no call to library.UpdateDocumentCache(id) here.
I'm tempted to report this as an issue in Codeplex since I find it confusing that you have to use different methods to handle the documentcache when creating and deleting documents via the API.
I am noticing this same behavior when unpublishing a document using the API. Unpublshing the document using the API would not remove the document from umbraco.config unless I used umbraco.library.UnPublishSingleNode(). Using umbraco.library.UpdateDocumentCache(d.Id) and umbraco.library.RefreshContent() seemed to have no affect on the umbraco.config file.
I am using Umbraco 4.5.2, IIS7 and .NET 4.0.
Jesper's code above seems to be a valid workaround for me for now, but I still feel like this should be logged as a bug.
Hey all I am experiencing a similar issue, after using the Document method delete() node is deleted in the backend but usng umbraco.library.RefreshContent(); does not refresh the content in the front end.
any one had a similar problem and found a solution?
UpdateDocumentCache doesn't update unpublished documents
Hi all,
This concerns a site running Umbraco 4.6.2, IIS 7 and .NET 4
Examples on Unpublishing/Deleting nodes often uses code like the following:
Which seems to work fine when looking at things in the backend afterwards. But pages in frontend seems to ignore this when listing pages using xslt or umbraco.NodeFactory.Node.ChildrenAsList, which indicates it's a caching problem.
So my question is - how comes library.UpdateDocumentCache doesn't help here? It does exactly what it's supposed to do when creating publishing documents. Also I noticed that the following code works perfectly:
Notice that there's no call to library.UpdateDocumentCache(id) here.
I'm tempted to report this as an issue in Codeplex since I find it confusing that you have to use different methods to handle the documentcache when creating and deleting documents via the API.
What do you think?
Regards
Jesper Hauge
I am noticing this same behavior when unpublishing a document using the API. Unpublshing the document using the API would not remove the document from umbraco.config unless I used umbraco.library.UnPublishSingleNode(). Using umbraco.library.UpdateDocumentCache(d.Id) and umbraco.library.RefreshContent() seemed to have no affect on the umbraco.config file.
I am using Umbraco 4.5.2, IIS7 and .NET 4.0.
Jesper's code above seems to be a valid workaround for me for now, but I still feel like this should be logged as a bug.
Thanks,
Mike
Hey all I am experiencing a similar issue, after using the Document method delete() node is deleted in the backend but usng umbraco.library.RefreshContent(); does not refresh the content in the front end.
any one had a similar problem and found a solution?
L
ps: running umbraco v 4.5.2
Hi Lachlann,
As I wrote in the first post the second code example actualle will delete a node, and the frontend will be updated afterwards.
Regards
Jesper Hauge
is working on a reply...