Team,
While deleting unpublished page, I am getting below error. Can you please advise?
Code: var docs = DocumentHelper.GetDocuments() .Published(false);
foreach (var treenode in docs) { treenode.Delete(); }
Error:
[BaseInfo.Delete]: Object ID (MenuItemID) is not set, unable to delete this object.
at CMS.DataEngine.BaseInfo.Delete() at CMS.DocumentEngine.TreeNode.DeleteInternal() at CMS.DocumentEngine.TreeNode.Delete(Boolean useDocumentHelper) at CMS.DocumentEngine.DocumentHelper.DeleteDocument(DeleteDocumentSettings settings) at CMS.DocumentEngine.DocumentHelper.DeleteDocument(TreeNode node, TreeProvider tree, Boolean deleteAllCultures, Boolean destroyHistory, Boolean deleteProduct, String webRootFullPath, ArrayList deletedNodeIDs) at CMS.DocumentEngine.TreeNode.Delete(Boolean deleteAllCultures, Boolean destroyHistory, Boolean deleteProduct) at CMS.DocumentEngine.TreeNode.Delete(Boolean useDocumentHelper) at CMS.DocumentEngine.TreeNode.Delete() at Admin_Default.OnPreInit(EventArgs e) in d:\K8_Backup\CMS\Admin\Default.aspx.cs:line 35 at System.Web.UI.Page.PerformPreInit() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Thx.
Can you try deleting with DocumentHelper.DeleteDocument(treenode);
Please, sign in to be able to submit a new answer.