Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • pawan 1 post 21 karma points
    Mar 06, 2014 @ 15:30
    pawan
    0

    event not firing wrt document

    Hello,

    Im new to Umbraco.Currently, I installed Mvc version template(7.0.4). I was trying to fire event after document is published but Im not  able to make it:

    Following is my code:

    public class Events : ApplicationEventHandler
    {

        public Events()

        {

            ContentService.Published += ContentService_Published;

        }

     

        public void ContentService_Published(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs<IContent> e)

        {

            //throw new NotImplementedException();

        }

     

        protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)

        {

            base.ApplicationStarting(umbracoApplication, applicationContext);

     

            Document.AfterPublish += Document_AfterPublish;

        }

    public void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)

        {

            //throw new NotImplementedException();

        }

    }

     

    Please let me know if Im missing somthing.

     

     

  • Sam 47 posts 153 karma points
    Mar 07, 2014 @ 18:42
    Sam
    0

    I'm actually having problems with events not firing as well. Not sure if I'm doing something wrong or they aren't working in v7.0.4.

    Here's my plea for help on StackOverflow: http://stackoverflow.com/questions/22256817/umbraco-applicationeventhandler-events-not-firing

  • Matt Linsenbardt 24 posts 147 karma points
    Mar 07, 2014 @ 20:08
    Matt Linsenbardt
    0

    Hi Guys,

    I have just upgraded to 7.0.4 and can verify that my events are indeed still working. I am subscribing to the ContentPublishing event.

    Pawan, you are subscribing to the Published event, but you don't have any code inside your ContentService_Published method. What are you trying to achieve?

    Thanks,

    Matt

  • Sam 47 posts 153 karma points
    Mar 08, 2014 @ 23:51
    Sam
    0

    Figured out my problem. I was using this documentation, which says it is for 6.1+: http://our.umbraco.org/documentation/Reference/Events/application-startup

    Unfortunately, the new version 7 backend doesn't seem to call Document or Media events. Instead it is using the ContentService and MediaService events. So I had to wire up my events according to this instead: http://our.umbraco.org/documentation/Reference/Events-v6/MediaService-Events

  • Sam 47 posts 153 karma points
    Mar 08, 2014 @ 23:53
    Sam
    0

    Quite honestly, I think the documentation is the only thing holding Umbraco back from being the leader for CMS. The videos are great, but with the pace everything is changing they can't even get new versions of videos pushed out before something changes. Be nice if they started doing a manual for each version. I'd pay $30-$50 each major version for documentation that is up to date and accurate.

Please Sign in or register to post replies

Write your reply to:

Draft