Reputation: 699
I'm trying to find all references to all images in all blocks.
var searchClient = ServiceLocator.Current.GetInstance<IClient>();
var result = searchClient.Search<IContent>()
.For(item.Name)
.GetContentResult();
The code above returns me pages where the image is in the properties, but I cannot find a way to find images in the nested blocks.
Is there another way? or any other ideas?
Performance is for now is not a problem.
Upvotes: 0
Views: 438
Reputation: 21
Try
var referencedLinks = ContentRepository.GetReferencesToContent(item.ContentLink, false).Select(x => x.OwnerID);
var items = ContentRepository.GetItems(referencedLinks, LanguageSelector.AutoDetect());
Upvotes: 0