I am writing some event handlers in order to interact with the nodes in the Umbraco tree upon publishing (AfterPublish) and for some reason, my events don't seem to be caught. I added the class to a DLL and copied it to the bin folder, I am extending ApplicationBase and captuing the event like so:
using umbraco.BusinessLogic; using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic.property;
namespace DB.Utilities { class AutoWriteHPFeatureXml : ApplicationBase { // default constructor; call the event public AutoWriteHPFeatureXml() { Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish); }
//Check if the doctype is news if (sender.ContentType.Alias == "Feature") { foreach (Document d in sender.Parent.Children) { string name = d.Text; Property p=d.getProperty("hpFeatureSort"); } } } } }
Capturing Events
Hi all,
I am writing some event handlers in order to interact with the nodes in the Umbraco tree upon publishing (AfterPublish) and for some reason, my events don't seem to be caught. I added the class to a DLL and copied it to the bin folder, I am extending ApplicationBase and captuing the event like so:
This example is from Richard (http://www.richardsoeteman.net/PermaLink,guid,f470b6cf-40da-4aa9-a0d9-7b984fe9bf59.aspx) which is a gret post and overview, but I think I must be missing something.
Thanks for your help.
-- Nik
Nik, your class must be public, otherwise the umbraco runtime cannot pick up your class using reflection!
Cheers,
/Dirk
Also, restart app (touching web.config or app pool restart)!
DOH! Sorry for the obvious question. Should have caught that one.
is working on a reply...