Is there anyway which I can query all specific block which is not used anywhere?
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>()
Thanks so much mate .. very helpful :)
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'"