I am trying to wire up an on published event handler and I need to get the subtitle property value of the currently published item. I cannot seem to get this to work. There has to be an easier way
Something like:
public void SendPublishNotifications(Umbraco.Core.Models.IContent publisheditem, string contentClass)
{
//publisheditem.Id is my Content Item ID that was published
//I just want to GET this Content Item and access its Subtitle Property Value
}
That's great you got it sorted, but looking at that code and understanding what you said in your initial question, I think you might come up against "strange" errors.
Using the UmbracoHelper in event handlers etc is not recommended and there are better/more robust ways to get that data.
Also, using anything off of .Current should be avoided really and instead DI should be taken advantage of.
Would love to help you get up and running in a more stable approach if you are interested.
Get Details of Another Content Page
I am trying to wire up an on published event handler and I need to get the subtitle property value of the currently published item. I cannot seem to get this to work. There has to be an easier way
Something like:
Hi Robert.
Can you share more of your code? How is that method being called?
Thanks
Nik
I figured this out. This is what I was missing. Appreciate the willingness to assist Nik!!
Hi Robert,
That's great you got it sorted, but looking at that code and understanding what you said in your initial question, I think you might come up against "strange" errors.
Using the UmbracoHelper in event handlers etc is not recommended and there are better/more robust ways to get that data.
Also, using anything off of .Current should be avoided really and instead DI should be taken advantage of.
Would love to help you get up and running in a more stable approach if you are interested.
Thanks
Nik
is working on a reply...