Yep content is created, but as you said unpublished state. It all looks good in backend, the parent is published, and all property values are populated, correct doc type set etc.
The parent was initially set to use list view, but changing this makes no difference. The parent is a protected page, the whole site is, so maybe that is the issue, it seems to create the new page as a protected page though!?
Then check the value of the status object to actually find out what has happened. My hunch is that you have some mandatory properties that you haven't completed and hence publish is failing.
You can check status.Success to see if it was successful or not.
You can check status.Result.StatusType to get a more detailed status.
You can check status.Result.InvalidProperties to see which (if any) properties failed.
I have a "Hide in Navigation" check box hidden on the "Properties" tab that stupidly I thought would default to false, as soon as I set the value to false the content is published ok.
Content Service - Publish
I am using the content service to create some content, which I want to publish instantly;
var cs = Services.ContentService; var c = cs.CreateContent("New Page", 1102, "alias");
I then set some values;
c.SetValue("property", "value");
I then want to publish;
cs.SaveAndPublishWithStatus(c); or cs.Publish(c);
Neither actually publish the new content, I am populating all mandatory properties, am I doing something stupid here?
Does it create the new content (in an unpublished state)?
I assume there is already a parent node with ID 1102 and that it is published, along with all of its ancestors.
and I assume that you provided a proper content type alias (e.g., "BlogPost") rather than the actual string "alias".
Do you get errors (exceptions or entries in the Umbraco log)?
What specific version of Umbraco are you using?
Have you tried refreshing the page to see if the new content node is there?
Yep content is created, but as you said unpublished state. It all looks good in backend, the parent is published, and all property values are populated, correct doc type set etc.
The parent was initially set to use list view, but changing this makes no difference. The parent is a protected page, the whole site is, so maybe that is the issue, it seems to create the new page as a protected page though!?
v7.3.0-beta3
You should use:
Then check the value of the status object to actually find out what has happened. My hunch is that you have some mandatory properties that you haven't completed and hence publish is failing.
You can check
status.Success
to see if it was successful or not.You can check
status.Result.StatusType
to get a more detailed status.You can check
status.Result.InvalidProperties
to see which (if any) properties failed.Thanks Dan,
I have a "Hide in Navigation" check box hidden on the "Properties" tab that stupidly I thought would default to false, as soon as I set the value to false the content is published ok.
@Nicholas, thank you for your help as well.
Cheers
Chris
is working on a reply...