A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
First of all, are you using the new file system? The old one was based on VPP and the new is ContentData, just as pages and blocks. Please have a look in the SDK http://world.episerver.com/Documentation/CMS/ under the Assets and media heading.
This would be the equivalent to your code in 7.5:
var helper = ServiceLocator.Current.GetInstance<ContentAssetHelper>();
var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
var folder = helper.GetOrCreateAssetFolder(CurrentPage.ContentLink);
foreach (var item in contentLoader.GetChildren<MediaData>(folder.ContentLink))
{
}
Excuse my late reply. Thanks for you code snippet, Johan. Worked like a charm!
How do I get the URL of the item so that I can render the items in the markup?
Never mind. Found it!
var image = (ImageFile)item;
UrlResolver.Current.GetUrl(image.ContentLink);
I've got a piece of code from out 6.5 project that is not working in 7.5. Any idea why?