Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8901

Publishing Blog Post Using API

$
0
0
We are using Kentico v9 and are importing blog posts from Wordpress into Kentico. The post itself is being imported but is not being published. Here's the code being used to import//Create a new tree node of type blog post var postNode = TreeNode.New(BLOG_POST_PAGE_TYPE); postNode.DocumentPageTemplateID = BLOG_TEMPLATE_ID; //Replace carriage returns in blog post content with @br@, get rid of double quotes string content = (string)postRow.wp_post_content; content = content.Replace(@\r\n@, @@br@@).Replace(@\@\@@, @@); //Assign the blog post title, date and content postNode[@BlogPostTitle@] = (string)postRow.wp_post_title; postNode[@BlogPostDate@] = postRow.wp_post_date; postNode[@BlogPostBody@] = postRow.wp_post_content; postNode[@BlogPostAllowComments@] = (postRow.wp_comment_status.ToString() == @closed@) ? false : true; postNode.DocumentCulture = monthNode.DocumentCulture; //Publish the blog post TreeProvider treeProvider = new TreeProvider(); WorkflowManager workflowManager = WorkflowManager.GetInstance(treeProvider); WorkflowInfo workflow = workflowManager.GetNodeWorkflow(postNode); if (workflow != null) { postNode.Publish(@Imported@); } //Add the blog post node under the month node postNode.Insert(monthNode); I found out the postNode node does not have a workflow assigned to it. How do I assign a workflow using the API so I can publish the blog post?

Viewing all articles
Browse latest Browse all 8901

Trending Articles