Which doing JsonConvert.SerializeObject(new[] { "My Value" }); is totally fine but how would I know when to serialise the object for the property? How can I differentiate it from plain textbox etc?
I'm getting a list of all the children from the parent like:
var children = Umbraco.Content(parentGuid)?.Children ?? null;
Once looping through the CSV rows then I'll check to see if I can find the child using:
var request = contentService.GetById(foundChild.Id);
Then I can use properties field from request to see if it's matches properties then call request.SetValue( ... )
The only thing I can think of is to perform an if statement on the request.Properties.PropertyType.PropertyEditorAlias is equal to Umbraco.DropDown.Flexible and then serialise that.
If you have a better solution, please let me know. Thanks.
Csv Import using Content Service
Goal:
The ability to create/update records using CSV into Umbraco and other data sources in the future but for now just CSV.
Problem:
One of the document types I'm trying to import into has a dropdown list which doesn't like the text been stored.
Found solution to that issue at https://our.umbraco.com/forum/umbraco-8/96101-umbraco-8-contentservice-and-dropdown-list#comment-306917
Which doing
JsonConvert.SerializeObject(new[] { "My Value" });
is totally fine but how would I know when to serialise the object for the property? How can I differentiate it from plain textbox etc?I'm getting a list of all the children from the parent like:
Once looping through the CSV rows then I'll check to see if I can find the child using:
Then I can use properties field from
request
to see if it's matches properties then callrequest.SetValue( ... )
The only thing I can think of is to perform an
if
statement on therequest.Properties.PropertyType.PropertyEditorAlias
is equal to Umbraco.DropDown.Flexible and then serialise that.If you have a better solution, please let me know. Thanks.
Any reason not to use CMS Import? Will save you lots of trouble: https://our.umbraco.com/packages/developer-tools/cmsimport
The free version doesn't cover the updating records. It was amazing package but not in the budget though. Thanks for the suggestion.
is working on a reply...