AI OnAI Off
You posted in B2B forums,, but I am assuming you meant content cloud. If you want to use content delivery api you can query the block and the get the properties through rest.
https://docs.developers.optimizely.com/content-cloud/v1.5.0-content-delivery-api/docs/quick-start
If you want to get in the controller then you use the content repository to load the content reference. You can get the the refereneces from the content area used the items.
var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
if (page != null && page.ContentArea != null && page.ContentArea.Items.Any())
{
foreach (var contentItem in page.ContentArea.Items)
{
var item = contentLoader.Get<YOUR_CONTENT_TYPE>(contentItem.ContentLink);
// output necessary properties from content instance
}
}
Hi Mark, What is page instance here ? Can you please help me with real time code ?
Hi Everyone,
I want data in Controller from specific block which is basically used in one of the landing page (page type) and inside EPiServer.Core.ContentArea page type field.
Can anyone let me know with classes I need to use in my Controller to fetch block property values?
Thanks