Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Hi,
In your example, it looks like you're creating the block as a child of the articlePage where you should be creating it in that page's asset folder. The asset folder doesn't exist by default but you can get or create it as a single action like this:
var contentAssetHelper = ServiceLocator.Current.GetInstance<ContentAssetHelper>();
var assetFolderLink = contentAssetHelper.GetOrCreateAssetFolder(articlePage.ContentLink).ContentLink;
You can then use assetFolderLink as the parent of your new block in your GetDefault() call.
Hi,
i'm trying to create content in a ContentArea of a page. I want to store this block in "for this page", as if the user would create it there manually.
But i get an exception "...is not allowed to be created under ArticlePage ..." at _contentRepository.Save. So how to do it correctly? This is my code: