Unlike IPublishedContent, IContent is the raw data that is stored in the database and, I don't think, necessarily uses the same model as the IPublishedContent output.
The problem you are having is that GetValue on IContent doesn't interact with an Property Value Converters as they are for the front end only, so you have to extract the raw data from the property and manually de-serialise it into the correct model.
Can I ask, why are you trying to access the raw value from IContent?
I'm creating an export for a certain document type. This type can appear underneath a few different parent nodes/types and I haven't seen a way to get all nodes of a certain type (regardless of location in the tree) via the UmbracoHelper.
The ContentService offered 'GetPagedOfType' which did what I needed.
Is there an alternative to this which would return IPublishedContent?
For context: The exporter I've built is running as a hosted service. It can also be run manually via a handler. I've tried to use UmbracoContextAccessor and UmbracoHelper, but the site can't retrieve the Umbraco Context.
IEnumerable<MediaWithCrops> field returns null on IContent object
Hi,
I am retrieving nodes of a certain type using the following lines:
It returns the nodes I'm expecting, but I'm having trouble accessing the Images field which is supposed to be the type of IEnumerable
page.GetValue("images"); returns:
The following code returns null:
How do I retrieve the information from this field?
Hi Jake,
Unlike
IPublishedContent
,IContent
is the raw data that is stored in the database and, I don't think, necessarily uses the same model as theIPublishedContent
output.The problem you are having is that GetValue on IContent doesn't interact with an Property Value Converters as they are for the front end only, so you have to extract the raw data from the property and manually de-serialise it into the correct model.
Can I ask, why are you trying to access the raw value from IContent?
Thanks
Nik
I'm creating an export for a certain document type. This type can appear underneath a few different parent nodes/types and I haven't seen a way to get all nodes of a certain type (regardless of location in the tree) via the UmbracoHelper.
The ContentService offered 'GetPagedOfType' which did what I needed.
Is there an alternative to this which would return IPublishedContent?
For context: The exporter I've built is running as a hosted service. It can also be run manually via a handler. I've tried to use UmbracoContextAccessor and UmbracoHelper, but the site can't retrieve the Umbraco Context.
is working on a reply...