Copied to clipboard

Flag this post as spam?

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


  • Jacob Jensen 10 posts 31 karma points
    Dec 13, 2013 @ 12:28
    Jacob Jensen
    0

    MediaType.BeforeSave event, how to subscribe

    Hi.

    Iam facing some problems catching any MediaType event. I need to do a import/sync from another media library (Razuna) if a media folder is saved.

            protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
                Document.BeforePublish += Document_BeforePublish;
                umbraco.cms.businesslogic.media.MediaType.BeforeSave += MediaType_BeforeSave;
    
            }
    
            private void MediaType_BeforeSave(umbraco.cms.businesslogic.media.MediaType sender, SaveEventArgs e)
            {
                HttpContext.Current.Response.Write(sender.Alias); /* DONT WORK */
            }
    
            private void Document_BeforePublish(Document sender, PublishEventArgs e)
            { 
          HttpContext.Current.Response.Write(sender.ContentType); /* WORKS FINE */
        }

    Can anyone help me out, iam using 6.1.6

    Best regards
    Jacob

  • 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