I am building an Umbraco 15 application.
- The application contains a page of type
Countries
. - The page has a property called
countryList
, which is a Block List Editor. - It contains blocks with a DocumentType of
Country
.
I want to add new ‘countries’ to this Block List programatically (i.e. add new content to the Block List). How do I achieve this?
I currently retrieve a reference to the page and the property using the following code, but then I’m at a loss how to add content to the list.
CountryPage page = _umbracoHelper.Content(CountryPageId()) as CountryPage;
BlockListModel blockList = page.CountryList;
Can anyone point me in the right direction?
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/115165-how-to-programmatically-add-content-to-a-block-list