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.
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.
Ok, So I think I figured it out.
In the document.afterpublish event I needed to call:
And after making that call, I am able to get the URL using:
Thanks, this helped me out! :)
Very helpful indeed!
is working on a reply...