Problem with creating content and media programmatically
Hi Guys,
Stumped. Using Umbraco 9.5.2
I have a form where a user submits a resume and and some basic info. I take the info and the resume formfile (pdf, docx, etc) and create content programmatically. I can successfully create the media file and save it to a media folder. I can successfully create the content and save to the CMS, with the exception of the media picker property which I am passing the reference to the media file I created... Umbraco will not populate that property with the created media file. I thought maybe scoping and have moved references all around, etc., to no avail. What am I missing and thanks for any help you can provide.
Problem with creating content and media programmatically
Hi Guys,
Stumped. Using Umbraco 9.5.2
I have a form where a user submits a resume and and some basic info. I take the info and the resume formfile (pdf, docx, etc) and create content programmatically. I can successfully create the media file and save it to a media folder. I can successfully create the content and save to the CMS, with the exception of the media picker property which I am passing the reference to the media file I created... Umbraco will not populate that property with the created media file. I thought maybe scoping and have moved references all around, etc., to no avail. What am I missing and thanks for any help you can provide.
string nodeName = $"{RemoveSpecialCharacters(model.FirstName)} {RemoveSpecialCharacters(model.LastName)}";
Hi Brett,
What datatype is your resumeFile property ?
Dave
Solved this, by creating and passing a Udi to the SetValue method. I don't know how I missed this page in the documentation:
https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3
Here is the complete code for reference:
is working on a reply...