简体   繁体   中英

Episerver find all image references

I'm trying to find all references to all images in all blocks.

  1. I can get all images
  2. I can't find all references in nested 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.

Try

var referencedLinks = ContentRepository.GetReferencesToContent(item.ContentLink, false).Select(x => x.OwnerID);
var items = ContentRepository.GetItems(referencedLinks, LanguageSelector.AutoDetect());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM