can't get this to work. I want to receive the last 5 updated/created media items of type "File" from a complex subfolder structure in the media section. It's no problem to order it by "Name" (asc and desc), but ordering by date fails (asc and desc).
@inherits umbraco.MacroEngines.DynamicNodeContext
@using umbraco.MacroEngines
@{
var docs= Model.MediaById(1071); <ul>
@foreach(var doc in docs.DescendantsOrSelf("File").OrderBy("updateDate desc").Take(5)){
<li><a href="@doc.umbracoFile">@doc.Name</a></li>
}
</ul>
}
Did you try and order by "UtcModified"? May or may not work, that's the actual name of the property on the ITypedEntity type (or something) rather than an "alias".
Get all media sorted by date
Hi,
can't get this to work. I want to receive the last 5 updated/created media items of type "File" from a complex subfolder structure in the media section.
It's no problem to order it by "Name" (asc and desc), but ordering by date fails (asc and desc).
Any hints?
Thanks
Did you try and order by "UtcModified"? May or may not work, that's the actual name of the property on the ITypedEntity type (or something) rather than an "alias".
thanks, but doesn't work.
Sorry, forgot to mention an important bit: should work with Umbraco 4.7.1.1
Do you ever get this to work?
Hi Matthias
Try Changing this OrderBy("updateDate desc") to OrderBy("id desc").
I had the same issue when trying to order by createDate.
//fuji
Hi,
@Trevor: no, i switched to a usercontrol and solved it via the api.
@Fuji: thanks, sounds indeed like a good workaround - will give it a try.
Matthias
is working on a reply...