Programmatically creating Blocks in the Rich Text Editor

As you’re able to create blocks that can be rendered in the rich text editor (Blocks in Rich Text Editor | Umbraco CMS), I was wondering if anyone has had any experience or suggestions as to how to create them programmatically in the RTE?

I’m not wanting to create the actual blocks themselves for use in the RTE, but programmatically add already existing blocks into the RTE. I’ve taken a look at the generated source code and it is the following:

<umb-rte-block class="ng-scope ng-isolate-scope" data-content-udi="umb://element/a60afc8a94ef453ab152f90f560ccb45"><!--Umbraco-Block--></umb-rte-block>

However, I can’t seem to find out how I can either generate a umb://element UDI and perform creation that way or whether I’m missing a very obvious way to do so.

I’d like to be able to add blocks to the RTE via the ContentService.

Any suggestions would be greatly appreciated!

1 Like