Copied to clipboard

Flag this post as spam?

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


  • Bex 444 posts 555 karma points
    Aug 19, 2014 @ 15:22
    Bex
    0

    Document_AfterPublish/Save view content changed

    Hello

    I am having difficultly rooting through the documentation so I am not sure if what I am trying to do it possible..

    I have been asked to send an email out to all members of a site if the content of the site changes. Obviously I don't want to go sending out emails every time a typo is fixed, as people will start getting annoyed, so I somehow need to check what content has been changed from and what the new content is so I can see if a significant amount has changed.

    I know how to hook into the document afterpublish/after save but I am not sure how to use them and if I can see that detail here.

    Is there a way of doing this?

    Thanks

    Bex

  • Bex 444 posts 555 karma points
    Aug 19, 2014 @ 16:51
    Bex
    0

    Ok, found a way. If anyone has any better ways please let me know..

     void Document_BeforePublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
        {
            var versions = sender.GetVersions().OrderByDescending(x => x.Date);
            var lastVersion = versions.First();
            Document d = new Document(sender.Id,lastVersion.Version);
    
            var properties = d.GenericProperties;
            foreach (var prop in properties)
            {
    
            }
        }
    

    not completely tested yet but sure it'll be along the right lines

  • 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