There is a delete method for the Document object... something like this...
Code:
using umbraco.cms.businesslogic.web;
void deleteById(int nodeID)
{
Document objDel = new Document(nodeID);
objDel.delete();
}
Notes (things I've discovered):
1. This just seems to remove the references to the ID from the database (children, node, properties, versions, document types, etc).
2. If you don't then do a republish all, then the XML tree is different from the database. This can cause problems if you're subsequently using the XML tree to find nodes that now don't exist in the database. At the very least, your browsers won't see a change in the website until there is a republish all.
3. Keep a backup of the database in case you muck things up! What's good is that most things are quite easy to fix as the structure of the database is quite logical and well thought out.
4. DO USE THE APIs, DON'T SIMPLY TRY AND DELETE FROM THE DATABASE. You are asking for trouble, esp. as you'll probably leave loads of stuff in that can then break the GUI.
5. As an aside, I'm just trying to figure out why the nodes aren't being removed from the system index in my setup... The delete method should remove then, it's just there is an exception. The system index appears to be a lucene index under _systemindexdonotdelete - and is used in the clever AJAX "find" function on the GUI. Not so clever when it finds a node that has been removed from the database but not the index - resulting in a system null exception. Niels may be able to shed some light on all this... :)
Hope this helps.
S.
Bawden Quinn Associates, UK