Media Summary

Topics: Customizing Orchard, General
Jan 10, 2014 at 11:39 PM
I'm trying to create a custom shape for listing media documents in a projection. I cannot seem to access the publishing date property. Here is what I have where the PublishedUtc comes up null.

@using Orchard.MediaLibrary.Models
@using Orchard.Utility.Extensions;
@{
MediaPart mediaPart = Model.ContentItem.MediaPart;
var contentTypeClassName = mediaPart.ContentItem.ContentType.HtmlClassify();
}
<article class="media-item media-item-summary @contentTypeClassName">
@Display(mediaPart.Title)
@Display.DateTime(DateTimeUtc: Model.PublishedUtc)
<a href="@Display(mediaPart.MediaUrl)">Download</a>
</article>
Coordinator
Jan 11, 2014 at 1:53 AM
mediaPart.ContentItem.As<CommonPart>().PublishedUtc
Marked as answer by runshoe on 1/13/2014 at 10:20 AM
Jan 12, 2014 at 4:27 PM
That didn't work. It just created an error rendering a blank page.
Coordinator
Jan 13, 2014 at 4:08 AM
What's the error?
Jan 13, 2014 at 6:20 PM
I was missing the namespace

@using Orchard.ContentManagement;

Thanks!