Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > API to delete nodes View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
slycknick - 4/22/2009 8:11:07 AM
   
API to delete nodes
I'm tring to use the API to delete a node and all its children using productTreeNode.DeleteAllCultures()

The problem I'm getting is that this produces a contraint error

Error
[DataConnection.ExecuteQuery]: Query: DELETE FROM CMS_Document WHERE [DocumentID] = @ID: caused exception: The DELETE statement conflicted with the REFERENCE constraint "FK__CMS_Attac__Attac__09A971A2". The conflict occurred in database "WMEC", table "dbo.CMS_Attachment", column 'AttachmentDocumentID'.
The statement has been terminated.

Is this the correct method to use or do I have to manually recurse through the tree and delete all children one by one.

Thanks
Nick



User avatar
Kentico Support
Kentico Support
kentico_jurajo - 4/23/2009 5:54:11 AM
   
RE:API to delete nodes
Hi Nick,

Could you please try to follow this example?
At the bottom is code sample how to delete/destroy the document with all dependencies. I hope it will help.

Best Regards,
Juraj Ondrus

User avatar
Certified Developer v7
Certified  Developer v7
slycknick - 4/23/2009 6:10:16 AM
   
RE:API to delete nodes
Brilliant. That worked a treat.