Treeprovider.CopyNode throws Exception: TreeNode.InsertAsNewCultureVersionInternal

Kenny Deblaere asked on May 11, 2017 12:20


I'm trying to copy a node to another path. This works when I'm doing this for one culture. Not having a translation.

But when I add a translated version I get the Exception: TreeNode.InsertAsNewCultureVersionInternal. "[TreeNode.InsertAsNewCultureVersionInternal]: The new culture version cannot be under different parent node than original node"

I'm using Kentico 9.0.50.

I have no clue why I get this, or this error occures.

Kind regards


Correct Answer

Kenny Deblaere answered on May 11, 2017 15:30

Hi Juraj

Thank you for your answer. I've done a workaround, but have an upgrade in the near future.

My workaround however, is a bit different:

var tree = new TreeProvider(MembershipContext.AuthenticatedUser);
var originalNodeContainer = tree.SelectNode(node.NodeParentID);
if(originalNode != null){
    var newNode = tree.CopyNode(node, originalNodeContainer, true);
    tree.MoveNode(newNode, nodeContainer, true);

This does also the trick, and I guess there are less operations?

Kind regards


0 votesVote for this answer Unmark Correct answer

Recent Answers

Juraj Ondrus answered on May 11, 2017 15:18

Hi Kenny,
Regrettably, there was a bug in Kentico 9. It was fixed in Kentico 10.
So, option no. 1 is the upgrade to Kentico 10.
Option no. 2 is a workaround and use the action context like this:

using (new DocumentActionContext { ResetChanges = true })
    foreach (var sourceChildNode in sourceNode.Children)
        var node = DocumentHelper.CopyDocument(sourceChildNode, documentEventArgs.Node, true, tree);
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.