I've got a problem, which probably isn't difficult, but I just can't see to firgure it out.
I've created a very simple import tool of a CSV fil, which create a new node, for each line.
If the node already exists i Umbraco ( basic check on nodename ), the node is updated with the data from the line.
If the node doesnt exist, it should be put i a library called "Usorterede" ( Unsorted ).
If the library/node "Usorterede" doesnt exists, it should be created first.
I've got a StreamReader to read the CSV file, an iterate through each line with
string line; while ((line = sr.ReadLine()) != null) { // DO CODE }
First I find the correct node to put the product in, by a propertyvalue
Document ItemGroup = (from itm in ProductNode.Children where itm.getProperty("itemGroupID") != null where itm.getProperty("itemGroupID").Value.ToString().Equals(values[6]) select itm).FirstOrDefault();
Then, if itemGroup exists, i check to see if "Usorterede" exists and if not, create it
if (ItemGroup != null) { Document UnsortedItemgroupNode = (from itm in ItemGroup.Children where itm.ContentType.Alias.Equals("unsortedProducts") select itm).FirstOrDefault();
and it works out fine, for the first creation, where no "Usorterede" don't exists.
Then the product gets created in the correct folder, and the code continues to the next line in the CSV file.
And this is where I don't get it, or i'm just missing something important.
The next time I run the
Document UnsortedItemgroupNode = (from itm in ItemGroup.Children where itm.ContentType.Alias.Equals("unsortedProducts") select itm).FirstOrDefault();
the folder I JUST created, isn't found, and when I look at the children count for the itemGroup, it doesnt change.
But when the code is done, and all the lines has been taken care of, I've got several folders in Umbraco called "Usorterede", "Usorterede (1)", "Usorterede (2)" etc..
Where am I missing something ?
It's like the cache isn't updated or something...I don't get it.
Document is null after it's created and published
Hey Umbraco Coders
I've got a problem, which probably isn't difficult, but I just can't see to firgure it out.
I've created a very simple import tool of a CSV fil, which create a new node, for each line.
If the node already exists i Umbraco ( basic check on nodename ), the node is updated with the data from the line.
If the node doesnt exist, it should be put i a library called "Usorterede" ( Unsorted ).
If the library/node "Usorterede" doesnt exists, it should be created first.
I've got a StreamReader to read the CSV file, an iterate through each line with
First I find the correct node to put the product in, by a propertyvalue
Then, if itemGroup exists, i check to see if "Usorterede" exists and if not, create it
and it works out fine, for the first creation, where no "Usorterede" don't exists.
Then the product gets created in the correct folder, and the code continues to the next line in the CSV file.
And this is where I don't get it, or i'm just missing something important.
The next time I run the
the folder I JUST created, isn't found, and when I look at the children count for the itemGroup, it doesnt change.
But when the code is done, and all the lines has been taken care of, I've got several folders in Umbraco called "Usorterede", "Usorterede (1)", "Usorterede (2)" etc..
Where am I missing something ?
It's like the cache isn't updated or something...I don't get it.
I've changed som code, to see if it was the while-loop, thath did something
But that didn't do anything. Same problem.
The children on ItemGroup, don't get updated, before the entire code has run, and I can see several folders in Umbraco named (1), (2) etc...
Solved. I think. At least it now works as it is supposed to.
Replaced
with:
is working on a reply...