Copied to clipboard

Flag this post as spam?

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


  • Kin 30 posts 172 karma points
    Mar 18, 2016 @ 19:51
    Kin
    0

    [ContentService] How to get the user who triggered the event?

    Hello,

    I was wondering how to get the user who triggered the event?

    protected override void ApplicationStarting(
        UmbracoApplicationBase umbracoApplication,
        ApplicationContext applicationContext)
    {
        base.ApplicationStarting(umbracoApplication, applicationContext);
    
        ContentService.SendingToPublish += Content_SendingToPublish;
    }
    
    private void Content_SendingToPublish(IContentService sender, SendToPublishEventArgs<IContent> e)
    {
       //How to get the user who triggered this?
    }
    

    Thank you.

  • Hywel Rees 56 posts 224 karma points
    Mar 19, 2016 @ 17:12
    Hywel Rees
    101

    Hi Kin,

    I believe you should be able to get the user via your e parameter.

    e.Entity.WriterId will return the Id for the user that made the change.

    Cheers,

    Hywel

  • 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