Delete Documents with Kentico API
//NameSpaces
using CMS.CMSHelper;
using CMS.GlobalHelper;
using CMS.SiteProvider;
using CMS.DocumentEngine;
using CMS.UIControls;
using CMS.EventLog;
public void DeleteDocument(string NodeAliasPath, string DocumentCulture)
{
TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);// Create an instance of the Tree provider first
TreeNode node = tree.SelectSingleNode(CMSContext.CurrentSiteName, NodeAliasPath, DocumentCulture); // Get the document
if (node != null)
{
DeleteProductActionEnum deleteSKUsAction = DeleteProductActionEnum.NoAction;
DeleteDocumentSettings settings = new DeleteDocumentSettings(node, tree, true, true, deleteSKUsAction);
DocumentHelper.DeleteDocument(settings);
//node.DeleteAllCultures();
}
}