Update TreeNode fails

Yannick - asked on June 21, 2016 16:17

I tried fetching the node with:

TreeNode node = tree.SelectSingleNode(SiteContext.CurrentSiteName, aliasPath + "/" + String.Concat(sku.SKUName.Replace(" - ", "-").Replace(" ", "-").Take(50)), TreeProvider.ALL_CULTURES);

and also with:

TreeNode node = DocumentHelper.GetDocuments() .OnCurrentSite() .Path(new string[] { aliasPath + "/" + String.Concat(sku.SKUName.Replace(" - ", "-").Replace(" ", "-").Take(50)) }) .AllCultures(true).FirstOrDefault();

And I tried updating the node with:

node.Update(false);

and with:

node.SubmitChanges(true);

But I keep getting the error: "Cannot insert duplicate key row in object 'dbo.View_CMS_Tree_Joined' with unique index 'IX_View_CMS_Tree_Joined_NodeSiteID_DocumentCulture_NodeID'" which makes sense as I didn't change the NodeSiteID, DocumentCulture or NodeID. I simply want to update the existing node.

Recent Answers


Brenden Kehren answered on June 21, 2016 23:40

Have you looked at the API Example documentation on getting and updating pages? I'd suggest checking this out.

0 votesVote for this answer Mark as a Correct answer

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