Block type which is not used anywhere else

Member since: 2011

Hi everyone,

Is there anyway which I can query all specific block which is not used anywhere?

Regards,

Aria

#132669 Aug 17, 2015 10:02
  • Hi,

    Maybue you could iterate through all block types and use IContentModelUsage service to check where the block is used:

     var contentUsage = ServiceLocator.Current.GetInstance<IContentModelUsage>();
     var usage = contentUsage.ListContentOfContentType(imageFileContentType);

    This will allow you to check block type usage.

    And if you need to check where specific block instance is used, the you could use ContentSoftLinkRepository

    var SoftLinkRepository = ServiceLocator.Current.GetInstance<ContentSoftLinkRepository>()

    #132672 Edited, Aug 17, 2015 10:33
  • Member since: 2011

    Thanks so much mate .. very helpful :)

    #132814 Aug 19, 2015 4:08
  • How do I use ContentSoftLinkRepository in EPiServer 9? I get an error saying "StructureMap.StructureMapConfigurationException: No default Instance is registered and cannot be automatically determined for type 'EPiServer.Web.IPermanentLinkMapper'"

    #162232 Oct 13, 2016 11:50