Hi,
I created a small Umbraco 15 website where I have a content picker for media folders (screenshot below).
When calling the property from a template e.g. content.Folder
(from the modelsbuilder generated model), the folder is properly returned as IPublishedContent
.
Now I want to get the images inside this folder, so I called content.Folder.Children()
, but this seems to return null, even though there are 3 images inside this folder in Umbraco Media. Am I doing something wrong (is there another way to get the images inside the picked folder), or is this a bug in Umbraco 15 ?
The way of getting the children as described above, seems to work in Umbraco 13 .
Hi @koenvanrasneve , and welcome to the new forum!
This is a known bug in Umbraco 15, and will be fixed in the upcoming v15.3 release (due out next week, all things being well).
opened 08:34PM - 03 Feb 25 UTC
closed 10:41AM - 03 Mar 25 UTC
type/bug
area/backend
affected/v15
release/15.3.0
### Which Umbraco version are you using? (Please write the *exact* version, exam… ple: 10.1.0)
15.1.1
### Bug summary
I see that `IPublishedCache.GetAtRoot()` is obsolete now in Umbraco 15, but it seems that something also changed in how it works going from 15.1.0 to 15.1.1
### Specifics
I Use this snippet to get all of my items from Media section:
public IEnumerable<IPublishedContent> GetAllMedia()
{
if (contextAccessor.TryGetUmbracoContext(out var context) == false)
return [];
var mediaRoot = context.Media?.GetAtRoot() ?? [];
return mediaRoot.DescendantsOrSelf<IPublishedContent>();
}
Up until 15.1.1 the `DescendantsOrSelf()` would return a collection with all the items at Root and all of its Children , in later versions Children are not loaded at all and could not be enumerated.
Im not sure if this is a bug or intended.
Anyways im not sure how to get all media with suggested new Interfaces (IDocumentNavigationQueryService, possibly IMediaNavigationQueryService in my case).
### Steps to reproduce
Run the debugger trough the snippet above and look at the returned values Children.
### Expected result / actual result
_No response_
There’s an RC of v15.3 available right now if you want to take it for a spin.
2 Likes
Hi @JasonElkin thanks for clearing this up! Didn’t see this issue.
1 Like
system
(system)
Closed
March 18, 2025, 9:05pm
4
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.