Copied to clipboard

Flag this post as spam?

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

  • Tobias Morf 80 posts 183 karma points
    Oct 12, 2013 @ 17:10
    Tobias Morf

    Cancel Document_BeforePublish event

    When I try to cancel the Document_BeforePublish event with e.Cancel = true I get a YSD.

    We are using 6.1.5

    The error message is:

    [NullReferenceException: Object reference not set to an instance of an object.]
       umbraco.cms.presentation.editContent.ShowMessageForStatus(PublishStatus status) +58
       umbraco.cms.presentation.editContent.Publish(Object sender, EventArgs e) +141
       umbraco.controls.ContentControl.DoSaveAndPublish(Object sender, ImageClickEventArgs e) +158
  • Tobias Morf 80 posts 183 karma points
    Oct 14, 2013 @ 17:12
    Tobias Morf

    I have tried everything (related to

    • ApplicationEventHandler
    • IApplicationEventHandler
    • ApplicationStartupHandler
    • ApplicationBase

    I know that I should use ApplicationEventHandler because of our version (6.1.5) :-)

    Any suggestions?

  • Alexander 3 posts 23 karma points
    Nov 01, 2013 @ 12:10

    Has anyone solved this problem?

  • Tobias Morf 80 posts 183 karma points
    Nov 04, 2013 @ 14:47
    Tobias Morf

    Yes - we had to recompile the Umbraco source. You will find the affected file here: \src\umbraco.cms\businesslogic\web\Document.cs

    Instead of

    return Attempt<PublishStatus>.False;

    we wrote

    return new Attempt<PublishStatus>(false, new PublishStatus(Content, PublishStatusType.FailedCancelledByEvent));

    You have to change two lines (1031 and 1034).

    Cheers Tobias

  • Sebastiaan Janssen 5039 posts 15427 karma points MVP admin hq
    Dec 19, 2013 @ 12:17
    Sebastiaan Janssen

    Hi Tobias, would be awesome if you could send in a pull request with that fix so that you don't have to keep customizing the core for each release!

    Let me know if you need a hand with that.

Please Sign in or register to post replies

Write your reply to: