Yes, you'll need to update the cache after you delete the document.
You can store the node's ID in a variable before you delete it, then use that variable when calling UpdateDocumentCache(). If that doesn't work you can try using the node's parent ID, ex:
int parentId = documentNode.ParentId; documentNode.delete(True); umbraco.library.UpdateDocumentCache(parentId);
Deleting nodes programmatically
Hi all,
I'm deleting a node in my codefile (Umbraco 4.7.1) with the following code
If I after this point execute the code
This is what I expected because I deleted the node, but if I use
This is not what I hoped for. Do I have to update the cache in anyway? I only know the statement
to update the cache, but this node.id does not exist any longer.
I hope someone has an answer,
Jeffrey
Hi Jeffrey,
Yes, you'll need to update the cache after you delete the document.
You can store the node's ID in a variable before you delete it, then use that variable when calling UpdateDocumentCache(). If that doesn't work you can try using the node's parent ID, ex:
HTH,
Tom
You might also need to add a call to umbraco.library.RefreshContent() if the above doesn't do the trick.
Hi Tom,
thanks for your replies. The umbraco.library.RefreshContent() seems to be necessary and now it works
Thanks a lot!
Jeffrey
is working on a reply...