Closed cheeseytoastie closed 2 months ago
Hi there @cheeseytoastie!
Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.
We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.
Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:
Heyo π This is expected behavior from V14 and onwards π
We have obsoleted the SaveAndPublish
method on the content service, at it is now split into separate Save
& Publish
methods π
Here is the message:
So the code to save and publish should now look more like:
var parentId = Guid.Parse("aa496be1-2d77-4c51-8201-a492dba317d1");
var testNewPageThatWorks = _contentService.Create("New Page Test", parentId, "root", -1);
testNewPageThatWorks.SetValue("title", "This is a test");
// Save and publish the child item - but if we save first then it works!!
_contentService.Save(testNewPageThatWorks);
_contentService.Publish(testNewPageThatWorks, Array.Empty<string>());
The method is marked as Deprecated not obsolete so I'd expect old behaviour.
The documentation also has this as the recommended way. Both should be updated before this ticket is just closed IMHO https://docs.umbraco.com/umbraco-cms/reference/management/using-services/contentservice
It is deprecated, but the warning message warns about it no longer saving π Good point about documentation, you can create an issue on the Docs repo, to make sure it is handled here: https://github.com/umbraco/UmbracoDocs/issues
Or I can open it for you if you prefer that πͺ
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
14.0.0
Bug summary
If you create a new node then just use SaveAndPublish it fails to save and publish.
If you use Save() first then SaveAndPublish it works
Simple example in a Razor view below -
Specifics
No response
Steps to reproduce
Run the razor above in a clean Umbraco install (obviously need the corresponding generalPage doc type.
Expected result / actual result
I would expect two nodes - one from the save -> save and publish route then the second (which isn't created) just using saveandpublish.
Noted by Treefiddy in the Discord and can recreate.
This item has been added to our backlog AB#41896