Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm trying to modify a query that searches for all media items of a single document type under a folder to return all media items that are one of two document types. Pretty sure this is very simple and I'm just missing something, but could anyone help?
fileList = Umbraco.TypedMediaAtRoot().DescendantsOrSelf("File").Where(x => x.Path.Contains(Model.DocumentFolder.Id.ToString()))
I assumed I could do one of the following but neither are correct:
<snip> .DescendantsOrSelf().Where(x => x.DocumentTypeAlias == "File" || x.DocumentTypeAlias == "OtherDocTypeName") <snip>
<snip> .DescendantsOrSelf("some or query in here") <snip>
You could try this:
var fileList = Umbraco.TypedMedia(Model.DocumentFolder.Id).Descendants("File").ToList()
That wouldn't solve the problem, I'd still need an or clause inside Descendants()
This should work:
Umbraco.TypedMedia(Model.DocumentFolder.Id).Descendants().Where(x => x.DocumentTypeAlias == "File" || x.DocumentTypeAlias == "OtherType").ToList();
That's worked perfectly, thank you for your help.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted