Creating a new document
[C#]
string newsName = "My first news"; // create tree provider instance CMS.TreeEngine.TreeProvider provider = new CMS.TreeEngine.TreeProvider(CMS.CMSHelper.CMSContext.CurrentUser);
// get parent node for new document CMS.TreeEngine.TreeNode parent = provider.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentSiteName, "/News", "en-us");
// create a new tree node CMS.TreeEngine.TreeNode node = new TreeNode("cms.news", provider);
if (parent != null) { // set document properties node.NodeName = newsName; node.NodeAlias = newsName; node.SetValue("DocumentCulture", "en-us"); node.SetValue("NewsTitle", newsName); node.SetValue("NewsSummary", "Some summary."); node.SetValue("NewsText", "Some text."); node.SetValue("NewsReleaseDate", DateTime.Now); // create New document node.Insert(parent.NodeID); } |
Page url: http://devnet.kentico.com/docs/devguide/index.html?creating_documents.htm