I think I’m probably missing something really obvious, but I can’t for the life of me get this working.
I’m creating content programatically, and importing media files to be attached to it through a MediaPicker3 property editor.
The media imports into the media library without issue, and returns me an IMedia object for each one.
All the docs/stack overflow posts etc that I find refer to just doing something like
content.SetValue("propertyAlias", media.GetUdi())
(where content and media are the IContent and IMedia objects, respectivly).
However, the property in question supports multiple media items, so I assumed that passing a IEnumerable would be the way to go - but the property is always empty after the content is created. I’ve tried passing it as an explicit array (GuidUdi[]) and passing the entire IMedia object instead of just the Udi (IEnumerable<IMedia> and IMedia[]).
If I may give you a suggestion; if you run into these kind of issues, just check the Umbraco source code. It’s relatively easy to find out what the content structure is of a property editor, it’s raw value.
That was my original port of call but, as v13 is no longer the main branch, searching GitHub is a nightmare - it was giving results about an IMediaImportService that doesn’t exist, and generally un-navigatable.
Unless you know the codebase inside out, and know exactly which folder to look in, the source often adds more confusion. Ideally we need the documentation to be better maintained to give accurate examples.