Try our conversational search powered by Generative AI!

Adding Blocks into a content area programmatically


hi, is there a way to add block on a content area programmatically?


Dec 19, 2013 4:29

Yes. Here's some pseudo code



Or if you already have a contentarea with references something like this.


Don't forget to save the page

contentRepository.Save(yourpageobject, EPiServer.DataAccess.SaveAction.Publish, Security.AccessLevel.NoAccess);

Dec 20, 2013 8:47

This does not appear to work. After adding the block (IContent) it appears in the ContentArea, but after the save and reload the block disappears. It's also worth noting that it best to set where the saved block will be saved.

Jun 25, 2014 10:00
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.