Kentico 8 Pages API inserts record in database but don't show in 'Pages' application

Aniruddha Patil asked on April 3, 2015 08:32

Hi,

I am inserting pages using api. I have pages information in a database table. I am using following code:

TreeNode parentNode = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/Content-Migration ", "en-us");
            if (parentNode != null)
            {
                foreach (DataRow dr in rootTab.Rows)
                {
                    var documents = tree.SelectNodes("CMS.MenuItem");

                    TreeNode newNode = TreeNode.New("CMS.MenuItem", tree);
                    newNode.DocumentName = Convert.ToString(dr["Page_Title"]);
                    newNode.NodeAlias = Convert.ToString(dr["Page_Title"]).Replace(" ", "-");
                    newNode.NodeName = Convert.ToString(dr["Page_Title"]);
                    newNode.DocumentCulture = "en-US";
                    newNode.DocumentPageTemplateID = 23689;
                    newNode.Insert(parentNode);
                    newNode.DocumentContent.EditableWebParts["WebPart_PageHeading"] = Convert.ToString(dr["OnPageTitle"]);
                    newNode.DocumentContent.EditableWebParts["WebPart_PageContent"] = Convert.ToString(dr["TheContent"]);
                    newNode.SetValue("DocumentPageKeyWords", dr["metakeywords"]);
                    newNode.SetValue("DocumentPageDescription", dr["Meta_Description"]);
                    newNode.Update();
                    int latestNodeID = newNode.NodeID;
                    dr["NewNodeID"] = latestNodeID;
                    WorkflowManager workflowManager = WorkflowManager.GetInstance(tree);
                    WorkflowInfo workflow = workflowManager.GetNodeWorkflow(parentNode);
                    if (workflow != null)
                    {
                        workflowManager.PublishDocument(newNode, null);
                    }                    
                }
            }

But I am facing a problem. Pages information is inserted in database. That's right. But I am unable to view that inserted pages in 'Pages' application. I am not understanding what mistake I have done. Can you guide me?

Recent Answers


Brenden Kehren answered on April 3, 2015 15:32

You might check to see if you have a node name with this EXACT text:

"/Content-Migration "

VS what I'm guessing it should be:

"/Content-Migration" // no space
0 votesVote for this answer Mark as a Correct answer

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