I try to use a custom Media property. But I get:
Object not set to an instance of an object.
The x.GetPropertyValue doesn't find the custom Media properties at all. Does anyone know how to go about this?
I use ver 6.1.5
var rootMedia = Umbraco.TypedMediaAtRoot();
var rootFiles = rootMedia.Select(x => x)
.Where(x => x.DocumentTypeAlias == "File" && x.GetPropertyValue("umbracoExtension").ToString().Contains("pdf"));
var descendantFiles = rootMedia.SelectMany(x => x.Descendants())
.Where(x => x.DocumentTypeAlias == "File" && x.GetPropertyValue("umbracoExtension").ToString().Contains("pdf"));
var oFiles = rootFiles.Union(descendantFiles)
.Where(x => x.GetPropertyValue("documentMetaData").ToString().Contains(metadata_id))
.OrderByDescending(x => x.CreateDate);
↧