Skip to content

Latest commit

 

History

History
129 lines (125 loc) · 3.42 KB

Document-Events.md

File metadata and controls

129 lines (125 loc) · 3.42 KB

#Document Events#

The Document class is the most commonly used type when extending Umbraco using events.

Document inherits from the CMSNode class, and will also have the Move and New events from there.

Event Signature Description
BeforeSave (Document sender, SaveEventArgs args) Raised before a document is saved from the UI, or when Document.Save() is called in the API.
NOTE: When the event is fired from the UI, then the "sender" will be the current document in the database, and not have the values that are about to be saved.
AfterSave (Document sender, SaveEventArgs args) Raised after a document is saved from the UI, or when Document.Save() is called in the API.
BeforeSendToPublish (Document sender, SendToPublishEventArgs args) Raised before a document is sent for publication. Setting args.Cancel = true will cancel the send.
AfterSendToPublish (Document sender, SendToPublishEventArgs args) Raised after a document is sent to publishing.
BeforePublish (Document sender, PublishEventArgs args) Raised before a document is published. Setting args.Cancel = true will cancel the publishing.
AfterPublish (Document sender, PublishEventArgs args) Raised after a document is published.
BeforeUnPublish (Document sender, UnPublishEventArgs args) Raised before a document is unpublished. Setting args.Cancel = true will cancel the unpublishing.
AfterUnPublish (Document sender, UnPublishEventArgs args) Raised after a document is unpublished.
BeforeCopy (Document sender, CopyEventArgs args) Raised before a document is copied. Setting args.Cancel = true will cancel the copy.
args.CopyTo contains the id of the target parent node.
AfterCopy (Document sender, CopyEventArgs args) Raised after a document is copied.
args.NewDocument contains the newly created copy.
BeforeMoveToTrash (Document sender, MoveToTrashEventArgs args) Raised before a document is moved to trash. Setting args.Cancel = true will cancel the move.
AfterMoveToTrash (Document sender, MoveToTrashEventArgs args) Raised after a document is moved to trash.
BeforeDelete (Document sender, DeleteEventArgs args) Raised before a document is deleted from the trashbin. Setting args.Cancel = true will cancel the delete.
AfterDelete (Document sender, DeleteEventArgs args) Raised after a document is delete from the trashbin.
BeforeRollBack (Document sender, RollBackEventArgs args) Raised before a document is rolled back to a previous version. Setting args.Cancel = true will cancel the rollback.
AfterRollBack (Document sender, RollBackEventArgs args) Raised after a document is rolled back to a previous version.