I am hoping someone can perhaps shed light as I am needing to resolve ASAP.
When copying a node with child nodes in program code. Then publishing all with children is OK if the date time for release is straight away.
However when I schedule the release date of the top level node then the top level node gets published at release date - but NONE of the children have published status.
All of these variants copy the node and children fine - but if the release date of the top level node is set to a future date then when that date comes round the children are not published.
If the top level node was saved with a forward release date then publishing the children shows failure in the status collection.
For my purposes then - I save the node without a release date, then publish all the descendants, then set a release date on the parent node and then save the node again.
When the release date comes around the parent and all children do now become available.
//get a copy of the site node I want to use to create a new site
var newNode = contentService.Copy(nodeToCopy, [xxx ParentID xxx], false);
//save the node (with all it's children)
contentService.Save(newNode);
//method below is strictly speaking named incorrectly - because it doesn't just publish children it publishes all descendants
var result = contentService.PublishWithChildrenWithStatus(newNode, includeUnpublished: true);
//now set the release date and re-save
newNode.ReleaseDate = [xxx FutureDate xxx];
contentService.Save(newNode);
PublishWithChildrenWithStatus
Urgent code question - issue.
I am hoping someone can perhaps shed light as I am needing to resolve ASAP.
When copying a node with child nodes in program code. Then publishing all with children is OK if the date time for release is straight away.
However when I schedule the release date of the top level node then the top level node gets published at release date - but NONE of the children have published status.
I have tried variations:
Then tried adding in the following too as a belt and braces approach
All of these variants copy the node and children fine - but if the release date of the top level node is set to a future date then when that date comes round the children are not published.
Issue resolved. The problem was this.
If the top level node was saved with a forward release date then publishing the children shows failure in the status collection.
For my purposes then - I save the node without a release date, then publish all the descendants, then set a release date on the parent node and then save the node again.
When the release date comes around the parent and all children do now become available.
is working on a reply...