Adding Documents using the new Document API

Debayo Graham asked on October 11, 2014 21:19

I need some help to add new documents using the new Kentico document API http://devnet.kentico.com/articles/kentico-8-technology-documentquery-api . In the previous version Kentico 7, TreeNode.Insert(2 methods) use to work but in the new version it has been deprecated. What is the replacement function?

This is my code snippet:

 if (parent != null)
 {
     node.NodeName = "MyFirstNews";
     node.NodeAlias = "MyFirstNews";
     node.SetValue("DocumentCulture", "en-us");
     node.SetValue("NewsTitle", "MyFirstNewsTitle");
     node.SetValue("NewsSummary", "My First News Summary.");
     node.SetValue("NewsText", "My First News Text.");
     node.SetValue("NewsReleaseDate", DateTime.Now);

    //To insert the document 
     node.Insert(parent.NodeID);

     return true;

 }

Recent Answers


Jameel Earle answered on October 11, 2014 21:31

I am also experiencing this problem. Does the functionality to add documents using the API exist?

0 votesVote for this answer Mark as a Correct answer

Yehuda Lando answered on October 12, 2014 12:30

I use it often. What do you mean deprecated?

It doesn't show as deprecated on my machine using Kentico 8.1.

What is deprecated is new TreeNode() which is replaced with TreeNode.New().

1 votesVote for this answer Mark as a Correct answer

Jameel Earle answered on October 13, 2014 01:59

No I don't think that is reference in the code snippet. The section that is deprecated in version 8 is: //To insert the document node.Insert(parent.NodeID); The question is how do you create a new document in Kentico version 8 from code or using the document API if possible?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 13, 2014 13:44

You might also check out the API Changes from 7 -> 8

0 votesVote for this answer Mark as a Correct answer

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