I am currently struggling with getting image data from my dynamic module. I have tried searching the net but still can't seem to get it working.
I have an IQueryable type which holds a collection of dynamic items. I am trying to do the following:
IQueryable<DynamicContent> rawBusinessBlocks = (Query to Sitefinity);
return rawBusinessBlocks .Select(b => new BusinessBlockType()
Title = b.GetValue<string>("Title"),
Body = b.GetValue<string>("Body"),
ExternalLink = b.GetValue<string>("ExternalLink"),
Image = b.GetRelatedItems<Image>("Image")
When I try the above it returns an empty image collection. But when using a single item e.g. rawBusinessBlocks.FirstOrDefault().GetRelatedItems<Image>("Image") it does return an Image object.
Not sure why I can't query image data on an IQueryable collection instead of a single item, any ideas?
Thank you all!