This works to a point and this is where the second issue arises
dataTypeContainerService.CreateAsync has an issue in that if a container with same name exists (at this stage have only proved if _options is in the root) then it dosent create _options under _rootDataContainer.
Expected result would be
IBD Data Types
Options
Options -- pre existing folder
Instead result is
IBD Data Types
Options -- pre existing folder
and _dataTypeContainerService.CreateAsync returns a "DuplicateName"
If Options doesn't exist at all then it creates the correct structure
Umbraco14 Get data type folder by name
Trying to create a data type folder programmatically in a migration.
Then will create the data types in that folder.
Im trying to create folders in the data types programatically Old v13 method was
However .CreateContainer is obsolete now and are using IDataTypeContainerService is recommended but has some crucial functions missing.
Mainly get container by name.
If I create the folder structure from scratch this is fine but when you come to update it later need to be able to find it from a know value.
How do you search the datatype container to find a existing folder.
this code creates it if not existent. or returns "DuplicateName" if already their.
_dataTypeContainerService.CreateAsync(Guid.NewGuid(), name, parentKey, user.Key);
What is the best way to get the Guid of the folder via its name.
Any thoughts.
I think I have figured it out. But It has highlighted some shortfalls and errors in the IDataTypeCOntainerService.
To make this work I have to routines one to find it the container exists the second to create it if it doesn't.
Find the container requires accessing the database directly and search for by name and parent key.
then if this returns a null create the container
So creating my containers I call them like this
This works to a point and this is where the second issue arises
Expected result would be
Instead result is
and _dataTypeContainerService.CreateAsync returns a "DuplicateName"
If Options doesn't exist at all then it creates the correct structure
is working on a reply...