Copied to clipboard

Flag this post as spam?

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


  • Stefan 10 posts 30 karma points
    Apr 26, 2010 @ 13:20
    Stefan
    0

    PublishAt - Document.AfterPublish not firing?

    Hi

    I need a little help.

    I have an eventhandler in which I have the Document.AfterPublish event.

    It looks like this:

    void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
            {
                if (sender.ContentType.Alias == "this" || sender.ContentType.Alias == "this1" || sender.ContentType.Alias == "that")
                {
                    foreach (Document d in sender.Children)
                    {
                        if (d.ContentType.Alias == "that" && d.Published)
                        {
                            d.Publish(sender.User);
                            umbraco.library.UpdateDocumentCache(d.Id);
                        }
                    }
                    umbraco.library.UpdateDocumentCache(sender.Id);
                    RemoveEventsXml();
                }
            }

            private void RemoveEventsXml()
            {
                System.Web.HttpContext.Current.Cache.Remove("this.ex");
                System.Web.HttpContext.Current.Cache.Remove("this.ex.1");
                System.Web.HttpContext.Current.Cache.Remove("this.ex.2");
            }

     

    It works like a charm when i press the "save & publish" button in umbraco.

    However, I would like this code to be executed when I use the PublishAt feature. But when the date/time comes the document/node is published but this event does not fire.

    What to do ?

    Is there a AfterPublishAt event ? if so I havent found it. :(

     

Please Sign in or register to post replies

Write your reply to:

Draft