简体   繁体   English

Episerver 查找所有图像引用

[英]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());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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