Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm running CMSImport 4.1.1 to import JSON files into an Umbraco 8.11.1 instance.
The JSON files are created by a custom export tool in an Umbraco 7.4.4 site.
I have an RTE property that needs to be imported into a Grid Layout property on the new site. The Grid Layout on the new site is going to be the same for every content item so my initial attempt was to render out the properly formatted JSON during my custom export from the Umrbaco 7.4.4 site.
CMSImport just imports this as a string to the new site. And it does insert properly and the 8.11.1 CMS does recognize it properly.
However, none of the media embedded in the RTE get imported. I'm not really surprised by this as I'm guessing CMSImport recognizes the string as JSON and does not attempt to parse it.
So my question is would it be appropriate for me to build a custom FieldProvider that parses the string and handles the embedded media? And if I went that route would I need to set the fieldProviderOptions.Break property?
Or is there another tactic to accomplish what I need that I'm not thinking of?
Grid Support is not supported by CMSImport since it's a definition of it's own so you don't need to set Break options.
The thing you need to do is return a string that exactly matches the JSON string how it will be stored in the database table.
For media import you can inject IMediaImport interface in your constructor of the Fieldprovider and use
_mediaImport.Import(relative path to file, parent udi for image folder ), parent udi for files folder, the user id to use, ShowErrorWhenMissing boolean)
That will give you a list of mediaimport result with id's you can use in your JSON object.
Hope this helps,
I got it working. I ended up creating a FieldProvider and also an AdvancedSettingProvider and AdvancedSettingOptions so that I could set the media root node and toggle the "break on missing items" flag. Works perfectly!
Thanks for your help!
Nice Chester, I think you are the first person creating a custom advanced settings provider :-)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted