I am currently working on an API for AngularJS integration. Via this custom apicontroller i would like to return the umbraco content tree in JSON. Currently this works but i cant seem to loop through to properties of the DynamicPublishedContent item to get the names and values.
These property are of type IPublishedProperty and i can view them in the quickwatch. But if i try to get this property value it gives an RuntimeBinderException.
Does anybody knows why this is the case? What can i do to get this properties in an array?
I managed to get the properties by making a reference to the contentservice. The returned object is of type Content. (Umbraco.Core.Models) Then i can loop through the properties:
var contentService = Services.ContentService;
var contentItem = contentService.GetById(page.Id);
foreach (var prop in contentItem.Properties)
{
// prop.Alias , prop.Value
...
}
Strange that by using dynamic representation with UmbracoHelper you cant loop through this properties:
var umbracoHelper = new Umbraco.Web.UmbracoHelper(UmbracoContext);
var contentItem = umbracoHelper.Content(page.Id);
foreach (var prop in contentItem.Properties)
{
// error
}
Loop through properties
Hi,
I am currently working on an API for AngularJS integration. Via this custom apicontroller i would like to return the umbraco content tree in JSON. Currently this works but i cant seem to loop through to properties of the DynamicPublishedContent item to get the names and values.
These property are of type IPublishedProperty and i can view them in the quickwatch. But if i try to get this property value it gives an RuntimeBinderException.
Does anybody knows why this is the case? What can i do to get this properties in an array?
I managed to get the properties by making a reference to the contentservice. The returned object is of type Content. (Umbraco.Core.Models) Then i can loop through the properties:
Strange that by using dynamic representation with UmbracoHelper you cant loop through this properties:
is working on a reply...