Doing a data import from a file on disk. Trying to delete all children of a node before rebuilding the children. I’m using the following code, but when I check if there’s a node there already, it says yes, even though I consigned them to the Recycle Bin and emptied it! I suspect I need to clear the items from the published cache, but can’t work out how to do it. Any advice appreciated.
var contentItems = courseList.Children()
.Select(child => contentService.GetById(child.Id)) // Get IContent versions
.Where(content => content != null)
.ToList();
foreach (var contentItem in contentItems) {
// Unpublish to remove from the frontend (IPublishedContent)
contentService.Unpublish(contentItem);
// Move to the Recycle Bin
contentService.MoveToRecycleBin(contentItem);
}
// Delete the items from the Recycle Bin
foreach (var contentItem in contentItems) {
contentService.Delete(contentItem);
}
Thanks