However, I need to get the new node's parent name. I can get the ID easily enough e.Model.ParentID but I clearly need to call in some other services as I cannot call IPublishedContent or similar at this point to easily get the node name for that ID.
I'm sure it's relatively simple, but my GoogleFu is failing me.
Get content by ID from within EditorModelEventManager
I'm having a go at setting a default value for a property on creation using this example: https://our.umbraco.com/documentation/reference/events/EditorModel-Events/#usage
However, I need to get the new node's parent name. I can get the ID easily enough
e.Model.ParentID
but I clearly need to call in some other services as I cannot call IPublishedContent or similar at this point to easily get the node name for that ID.I'm sure it's relatively simple, but my GoogleFu is failing me.
Hi..
You can inject the services you need access to in the constructor, e.g.
and then using it like this:
I recently updated the documentation with an additional example using
SendingMemberModel
and injecting `IMemberGroupService. https://our.umbraco.com/documentation/reference/events/EditorModel-Events/#usage/Bjarne
Thank You! Exactly what I was after
is working on a reply...