Block type which is not used anywhere else

Vote:
 

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
Vote:
 

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
Vote:
 

Thanks so much mate .. very helpful :)

#132814
Aug 19, 2015 4:08
Vote:
 

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
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.