Attempting to create a node programmatically for content-only page type results in "The node MYNODEN

Stuart Freeman asked on January 30, 2020 01:30

I'm attempting to add a child node to an existing node using:

newPage.Insert(parentPage);
newPage.Publish();

This results in a "The node MYNODENAME does not support workflow" error.

the node is a content-only page type.

Correct Answer

Dat Nguyen answered on January 30, 2020 02:32

Have you applied a workflow to the parent item and its children? If you don't plan to, comment out the publish action and the error should not happen.

EDIT:

See this documentation to learn how to insert pages in different scenarios, like under workflow, versioning without workflow, etc.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Stuart Freeman answered on January 30, 2020 16:07

Hi Dat, If I apply workflow to the parent and then programmatically add a node will workflow automatically be applied to the new item? Thanks!

0 votesVote for this answer Mark as a Correct answer

Dat Nguyen answered on January 30, 2020 17:25

It should.

Programmatically, you can check if a page is under workflow, and if so, publish the page, like so:

   if (newPage.WorkflowStep != null)
   {
       newPage.Publish();
   }
0 votesVote for this answer Mark as a Correct answer

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