Hi, I'm writing a custom control and I have a content type with DAMP property valorized.
The DAMP is configured to store the data as full media xml, so this is my structure:
Basically I need to extract the "umbracofile" property. The basic object is an IContent and the property is "mediaContent". With Razor I would do this:
if (news.HasValue("mediaContent"))
{
var image = news.mediaContent.FirstOrDefault();
var imageUrl = image.Image;
var imageName = Path.GetFileNameWithoutExtension(@imageUrl.umbracoFile);
}
but in this case I'm managing an IContent. This is what I've done so far:
if ((e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)) return;
var user = e.Item.DataItem as IContent;
if (user != null)
{
if (user.GetValue<dynamic>("mediaContent")!=null)
{
var image = user.GetValue<string>("mediaContent"); //test
//var imageUrl = image.Image;
//var imageName = System.IO.Path.GetFileNameWithoutExtension(imageUrl.umbracoFile);
}
}
Getting DAMP image while using contentService
Hi, I'm writing a custom control and I have a content type with DAMP property valorized. The DAMP is configured to store the data as full media xml, so this is my structure:
Basically I need to extract the "umbracofile" property. The basic object is an IContent and the property is "mediaContent". With Razor I would do this:
but in this case I'm managing an IContent. This is what I've done so far:
Any hints?
is working on a reply...