In a class that gets images from an API and stuffs them into appropriate folders in Media I need to check the folder exists and if not, create it. As we can't now get Children easily and it doesn't look like I have IPublishedContent available either I'm looking for some help with syntax converting this (which works in V7):-
Thanks for that. I had to add Umbraco.Core to the Constants.Conventions.MediaTypes.Folder. I don't understand why though because there is a using statement for Umbraco.Core at the top of the code. I seem to trip over quite a few of these issues with V8 so far. Wonder if there's some scope I don't see or understand.
Hmm.. that's odd. I tried it just by adding the Umbraco.Core using at the top. And it worked fine for me. Maybe it was intellisense screwing around? Or was it a compilation error?
The code builds ok, but if I take Umbraco.Core off the Constants.Conventions then I get a red squiggly under "Constants" and "Name" further along the line.
Found the issue..... I had a "using Serilog.Core;" in as well as I'm struggling to get logging working (that's another thread ;) ). If I take it out, then we're all good without the extra inline Umbraco.Core :)
Check if Media Folder exists from a core class
Umb 8.6.1
Upgrading V7 code to V8
In a class that gets images from an API and stuffs them into appropriate folders in Media I need to check the folder exists and if not, create it. As we can't now get Children easily and it doesn't look like I have IPublishedContent available either I'm looking for some help with syntax converting this (which works in V7):-
To V8.6.1. What I've got so far is this:-
Which complains about IMedia not having GetPagedChildren and c.Name not being available and the docs aren't helping atm.
Any advice would be appreciated.
/ Craig
Hi,
I think the above will solve the problem.
-Joep
Hi Joep,
Thanks for that. I had to add Umbraco.Core to the Constants.Conventions.MediaTypes.Folder. I don't understand why though because there is a using statement for Umbraco.Core at the top of the code. I seem to trip over quite a few of these issues with V8 so far. Wonder if there's some scope I don't see or understand.
/ Craig
Hi Craig,
Hmm.. that's odd. I tried it just by adding the Umbraco.Core using at the top. And it worked fine for me. Maybe it was intellisense screwing around? Or was it a compilation error?
-Joep
The code builds ok, but if I take Umbraco.Core off the Constants.Conventions then I get a red squiggly under "Constants" and "Name" further along the line.
Found the issue..... I had a "using Serilog.Core;" in as well as I'm struggling to get logging working (that's another thread ;) ). If I take it out, then we're all good without the extra inline Umbraco.Core :)
Thanks :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.