Take the community feedback survey now.
AI OnAI Off
Take the community feedback survey now.
Hi,
You could try to use this code snippet:
var contentType = ServiceLocator.Current.GetInstance<IContentTypeRepository>().List().FirstOrDefault(ct=>ct.ModelType == typeof(JumbotronBlock));
var contentList = ServiceLocator.Current.GetInstance<ContentStore>().ListContentOfContentType(contentType, false).ToList();
var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
var contentCount = contentList.Count;
for (int i = 0; i < contentCount; i++)
{
var contentUsage = contentList[i];
contentRepository.Delete(contentUsage.ContentLink, false, AccessLevel.NoAccess);
}