Get all blocks of specific category

 

Hi, 

I would like to get all the blocks of specific category. 

Editors will choose category when creating blocks in different folders by using specific block type.  Is there any better way to get the block list based on category ID/Name ?

Any help would be much appreciated. 

Thanks,

Suresh

#190720 Apr 16, 2018 13:40
  • Member since: 2008
     

    Hi Suresh

    Does your solution use Episerver Find?

    David

    #190781 Apr 16, 2018 21:03
  • Member since: 2011
     

    if performance is secondary here, you can recursevily travel content tree and collect all blocks with that/those specific category(-ies). code should be quite simple (walking around the tree and asking for child items). but agree with David - you should look for some better options..

    #190788 Apr 16, 2018 22:04
  •  

    Thanks David and Valdis for your response.

    @David,

    I'm currently using Alloysite for exploring this. Yes Episerver find is there in my solution. Can you please guide me how this can be done using Episerver Find ?

    @Valdis,

    I'm new for Episerver, Could you please help me with the code snippet ?

    Thanks,

    Suresh

    #190802 Apr 17, 2018 10:57
  • Member since: 2015
     

    Taking a step back what are you trying to accomplish? Can you provide a use case?

    Categories are most useful on pages like press releases, so you can filter content by tags etc. 

    Maybe there is an alternate more effective solution than categorizing blocks?

    #190869 Apr 17, 2018 23:08