Copied to clipboard

Flag this post as spam?

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


  • glob 72 posts 172 karma points
    Jul 03, 2015 @ 05:32
    glob
    0

    Event handler in Umbraco 7

    Hello,

    Currently my blog is in umbraco 6. Now i want to switch into umbraco 7 but umbraco 6's event handler not working in umbraco 7 like Document.BeforePublish,Document.AfterPublish,Document.AfterSendToPublish etc....

    so what could be the reason behind the same? please can you help ? bcz i am stuck in between this.

    Awaiting your reply, With Regards...

  • Sören Deger 733 posts 2844 karma points c-trib
    Jul 03, 2015 @ 05:58
    Sören Deger
    0

    Hi glob,

    you can use the ContentService.Saving and ContentService.Saved event.

    Here you can find the documentation of this services:

    https://our.umbraco.org/documentation/Reference/Events-v6/

    Hope this helps.

    Best,

    Sören

  • glob 72 posts 172 karma points
    Jul 03, 2015 @ 07:37
    glob
    0

    Thanks for your quick reply.

    Old event handler not working in umbraco 7..right?

    With Regards,

  • Sören Deger 733 posts 2844 karma points c-trib
    Jul 03, 2015 @ 07:38
    Sören Deger
    0

    Yes

  • Sören Deger 733 posts 2844 karma points c-trib
    Jul 03, 2015 @ 08:06
    Sören Deger
    0

    Hi glob,

    if my first post above was helpful and has solved your problem, please mark my first post as solution. Then other people can easier find the post with the solution.

    Thanks :-)

    Best, Sören

  • Luke 110 posts 256 karma points
    Jul 03, 2015 @ 08:11
    Luke
    0

    Hi,

    For version 7 you need to plugin to the ContentService on app startup. Like so:

    namespace Umbraco.Extensions.EventHandlers
    {
        public class AppStartupEventHandler : ApplicationEventHandler
        {
            protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
                Umbraco.Core.Services.ContentService.Saved += Content_Saved;          
    }
    }
    }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies