Below you find a codesnippet. Basically you need to use the log class and use the LogTypes.Notiify Enum in combination with the documentID to Add a line to the AuditTrail of the document (Log.Add(LogTypes.Notify, sender.Id, "Added To AuditTrail");).
Had a feeling it might be via a log entry but wasnt 100% certain. Karma plus marked as solution. I am doing cancel on publish so all is good on that front as i am using 4.0.3
Add audit trail to document using api
Hello,
I have an action handler and am handling publish event. I am on certain criteria cancelling event what i wanted to do was after cancel add line to document audit trail. Just watched umbraco tv vid http://umbraco.org/documentation/videos/for-developers/events/cancel-publishing-with-events and per states it can be done, however video ends before showing how :-}
PS shameless plug in you dont have umbraco tv get it its awesome!
Regards
Ismail
I have tried using the e.cancel property, but for me it didn't work...
When I googled some, I found out it's a known bug :-/
Anyone; correct me if I'm wrong
Hi Ismail,
Are you trying to cancel the publish by returing false from the ation handler Execute method ?
http://www.aaron-powell.com/the-great-umbraco-api-misconception
This post also mentions that returing true / false has no effect:
http://www.dotnetmafia.com/blogs/kevin/archive/2008/02/13/umbraco-action-handlers-101.aspx
oops, Aarons post, refers to canceling via the event args as Stefan mentioned. Hopefully both will be fixed in 4.1 :)
Hi Ismail,
Below you find a codesnippet. Basically you need to use the log class and use the LogTypes.Notiify Enum in combination with the documentID to Add a line to the AuditTrail of the document (Log.Add(LogTypes.Notify, sender.Id, "Added To AuditTrail");).
Hope this helps you,
Richard
As I mentioned in this post - http://www.aaron-powell.com/umbraco-event-improvments you will be able to cancel Document Save events properly in 4.1
@all Cancel on Save will not work(until 4.1), Cancel a publish will work.
Richard,
Had a feeling it might be via a log entry but wasnt 100% certain. Karma plus marked as solution. I am doing cancel on publish so all is good on that front as i am using 4.0.3
Many thanks.
Ismail
is working on a reply...