Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Neil 40 posts 205 karma points
    Apr 27, 2023 @ 14:04
    Neil
    0

    Getting blocks by guid

    Does anyone know if it's possible to load the model for a block (either the PublishedElementModel or the underlying IPublishedElement) by it's Guid?

    Something like PublishedContentQuery.content(Guid) / ContentService.GetById(Guid) - but for blocks?

  • Søren Kottal 712 posts 4570 karma points MVP 6x c-trib
    Apr 28, 2023 @ 06:16
    Søren Kottal
    0

    Hi Neil

    You need to get the node that has the block first, and then you can filter the block list/grid property to find the desired block.

  • Neil 40 posts 205 karma points
    Apr 28, 2023 @ 07:51
    Neil
    0

    Yeah, that's what I've ended up doing. I was just hoping there was some build in indexing that I couldn't find documented, to avoid using reflection.

Please Sign in or register to post replies

Write your reply to:

Draft