Try our conversational search powered by Generative AI!

Unable to cast block type to IContent


I'm doing an episerver find indexing job where I want to take all blocks of type PersonBlock and create a new object which will be searchable. To save it to the index i need the blocks Id which I could get if i casted the blocktype to IContent but for some reason it's not working?

I've read this post already: which claims that it's not possible to cast it to IContent if it's a local block but this block is never used as a local block.

Maybe this has something to do with how i retrieve all my blocks


If so, I'm all ears how I can retrieve all my blocks of this type in a different way


Mar 19, 2014 16:21

Have you tried GetContent() instead?

Mar 19, 2014 17:59

That worked. Thanks!

Mar 20, 2014 8:33
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.