Copied to clipboard

Flag this post as spam?

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


  • Chris Sprague 11 posts 31 karma points
    Jul 05, 2011 @ 11:20
    Chris Sprague
    0

    Backend publishing not behaving as expected

    A project I'm working on calls for functionality to create nodes beneath a target node, which may already contain child nodes, and to publish all of those children when the publish button is hit in the designer UI.

    In order to accomplish this, I've subscribed to the BeforePublish event for the target node. When the event fires, I check the sender for children, then iterate over those children to 'publish' them.

    Here's the delegate: 

            public static void Document_BeforePublish(Document Sender, PublishEventArgs E)

            {

                if (_targetContentTypes.Contains(Sender.ContentType.Alias))

                {

                    foreach (var Child in Sender.Children)

                    {

                        Child.PublishWithResult(new User(0));

                    }

                }

            }

     

    _targetContentTypes is simply a managed list of document which should exhibit this behavior.

    My issue is that the  documents appear to publish in the content editor (they turn solid), but the updated data doesn't appear on the site. 

  • Chris Sprague 11 posts 31 karma points
    Jul 05, 2011 @ 11:26
    Chris Sprague
    0

    No sooner did I post this than I found the solution in another person's work. For some reason I can't delete this topic, so for those like me who are too lazy to read examples, use "umbraco.library.UpdateDocumentCache(Child.ID)".

Please Sign in or register to post replies

Write your reply to:

Draft