Copied to clipboard

Flag this post as spam?

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


  • Sean Mooney 131 posts 158 karma points c-trib
    Jul 23, 2009 @ 16:06
    Sean Mooney
    0

    Afterpublish get document url

    I am having some trouble with the document.afterpublish event. I created a user control that allows users to create documents using the API, this all works perfect. What I am trying to do is create an email when the document is published to notify the user that we published their document, again this works fine.

    The problem I am having is getting the URL of the published node. I have tried using umbraco.library.NiceUrl(sender.Id), this just returns a blank space if the document has was not published before. However if the document is published, and I publish it again the URL will be displayed properly.

  • Sean Mooney 131 posts 158 karma points c-trib
    Jul 23, 2009 @ 17:15
    Sean Mooney
    5

    Ok, So I think I figured it out.

    In the document.afterpublish event I needed to call:

    umbraco.library.UpdateDocumentCache(d.Id)

    And after making that call, I am able to get the URL using:

    umbraco.library.NiceUrl(d.Id)
  • Nalle Jacobsson 32 posts 55 karma points
    Jun 17, 2010 @ 16:57
    Nalle Jacobsson
    0

    Thanks, this helped me out! :)

  • DavidS 17 posts 38 karma points
    Jul 19, 2010 @ 18:29
    DavidS
    0

    Very helpful indeed!

  • 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