Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

How can I filter out content usages to remove trashed blocks?

$
0
0

I'm using this code to get the block data.

var blockType = contentTypeRepository.Load<RequisitionBlock>();
var contentUsages = contentModelUsage.ListContentOfContentType(blockType);
var contentReferences = contentUsages.Select(x => x.ContentLink.ToReferenceWithoutVersion()).Distinct().ToList();
var instances = contentReferences.Select(contentReference => contentLoader.Get<IContent>(contentReference)).ToList();

The usages bring up 9 items and as it gets to instances, it filters to 5 items. But there's only one active item on the site. I've deleted the rest. How can I filter out the deleted blocks?


Viewing all articles
Browse latest Browse all 9076

Trending Articles