I am trying to content from my umbraco site programmatically. I use
//nodeToDelete is a umbraco.NodeFactory.Node
Document documentToDelete = new Document(nodeToDelete.Id); documentToDelete.delete();
umbraco.library.RefreshContent();
This works fine and the content is deleted as it should. I get a warning that Document is deprecated and that I should use Content instead.
All the examples I find on our (even the farily recent ones) of people trying to delete content use Document and not Content. Because there is no "delete" method or anything like that on Umbraco.Core.Models.Content I don't know how to do it. Actually, I don't even understand how create the object from a Node.
What is the correct way to delete content since Document is deprecated?
Document deprecated : Using Content instead
I am trying to content from my umbraco site programmatically. I use
This works fine and the content is deleted as it should. I get a warning that Document is deprecated and that I should use Content instead.
All the examples I find on our (even the farily recent ones) of people trying to delete content use Document and not Content. Because there is no "delete" method or anything like that on Umbraco.Core.Models.Content I don't know how to do it. Actually, I don't even understand how create the object from a Node.
What is the correct way to delete content since Document is deprecated?
Thanks!
Hi Hugo
You should use the new API for CRUD operations.
here is your code with new API:
Tim has got a nice article of how to work with new API: http://www.nibble.be/?p=224
Cheers
Ali
Thanks a lot. I had not heard (or read about) the new API. It works for me.
Hi Hugo,
All the documentation for the v6 API can be found here
Jeavon
is working on a reply...