Episerver Content Events Explained

While IContentEvents interface is documented quite well, there are some missing parts which are described in this article. Mainly, I focused on the event arguments passed into the event handler. As an event consumer, I care about those the most.

Unfortunately, there are a lot of inconsistencies with these arguments. Some events pass in different types of arguments. There are also different properties filled with different data leaving some properties with default values and some with event data.

I haven't repeated a description of the events which can be found in the IContentEvents documentation and in the source code (you can see documentation through IntelliSense), just added a short description. When I haven't mentioned some event argument's property, then assume that it has a default value.

Event arguments

Here is the list of all event argument types used by events in the IContentEvents interface:

  • ContentEventArgs
  • ContentLanguageEventArgs
  • CopyContentEventArgs
  • DeleteContentEventArgs
  • MoveContentEventArgs
  • SaveContentEventArgs
  • ChildrenEventArgs

Events

LoadingChildren, LoadedChildren, and FailedLoadingChildren events

These events are raised on child content loading in the IContentLoader.GetChildren<T> implementations.

LoadingChildren

Raised: Before loading child content
Arguments:

  • ChildrenEventArgs with:
    • ContentLink - content link passed to IContentLoader.GetChildren<T> but without version
    • ChildrenItems - null

LoadedChildren

Raised: After child content loaded
Arguments:

  • ChildrenEventArgs with:
    • ContentLink - content link passed to IContentLoader.GetChildren<T> but without version
    • ChildrenItems - loaded child content

FailedLoadingChildren

Raised: On exception during child content loading
Arguments:

  • ChildrenEventArgs with:
    • ContentLink - content link passed to IContentLoader.GetChildren<T> but without version
    • ChildrenItems - can be null or loaded child content which can be loaded only partially

LoadingContent, LoadedContent, and FailedLoadingContent events

These events are raised on content loading in different methods of IContentLoader implementions.

LoadingContent

Raised: Before loading content but sometimes after content loaded (for example, in the GetBySegment method).
Arguments:

  • ContentEventArgs with:
    • ContentLink - loading content's content link
    • TargetLink - null

LoadedContent

Raised: After content loaded
Arguments:

  • ContentEventArgs with:
    • ContentLink - loading content's content link
    • TargetLink - null
    • Content - loaded content

FailedLoadingContent

Raised: On exception during content loading or when no content loaded (content is null)
Arguments:

  • ContentEventArgs with:
    • ContentLink - loading content's content link
    • TargetLink - null
    • Content - null

LoadingDefaultContent and LoadedDefaultContent events

These events are raised on new content item creation in the IContentRepository.GetDefault<T> and IContentRepository.CreateLanguageBranch<T> implementions.

LoadingDefaultContent

Raised: Before creating new content item
Arguments:

  • ContentEventArgs with:
    • ContentLink
      • empty content reference when raised from IContentRepository.GetDefault<T>
      • source content's content link without version when raised from IContentRepository.CreateLanguageBranch<T>
    • TargetLink
      • parent content link when raised from IContentRepository.GetDefault<T>
      • default value when raised from IContentRepository.CreateLanguageBranch<T>
    • Content - null
    • RequiredAccess
      • default value when raised from IContentRepository.GetDefault<T>
      • AccessLevel.Edit when raised from IContentRepository.CreateLanguageBranch<T>

LoadedDefaultContent

Raised: After new content item created
Arguments:

  • ContentEventArgs with:
    • ContentLink
      • empty content reference when raised from IContentRepository.GetDefault<T>
      • source content's content link without version when raised from IContentRepository.CreateLanguageBranch<T>
    • TargetLink
      • parent content link when raised from IContentRepository.GetDefault<T>
      • default value when raised from IContentRepository.CreateLanguageBranch<T>
    • Content - created content
    • RequiredAccess
      • default value when raised from IContentRepository.GetDefault<T>
      • AccessLevel.Edit when raised from IContentRepository.CreateLanguageBranch<T>

PublishingContent and PublishedContent events

These events are raised on content publishing in the IContentRepository implementations.

PublishingContent

Raised: Before content saving and when Transition.NextStatus is VersionStatus.Published
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - publishing content's content link
    • Content - publishing content
    • SaveAction - SaveAction.Schedule or SaveAction.Publish
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save or publish method

PublishedContent

Raised: After content saving and when Transition.NextStatus is VersionStatus.Published
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - updated publishing content's content link
    • Content - updated publishing content
    • SaveAction - SaveAction.Schedule or SaveAction.Publish
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save or publish method

CheckingInContent and CheckedInContent events

These events are raised on content checking in in the IContentRepository implementations.

CheckingInContent

Raised: Before content saving and when Transition.NextStatus is VersionStatus.CheckedIn or VersionStatus.DelayedPublish
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - checking in content's content link
    • Content - checking in content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

CheckedInContent

Raised: After content saving and when Transition.NextStatus is VersionStatus.CheckedIn or VersionStatus.DelayedPublish
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - updated checking in content's content link
    • Content - updated checking in content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

RequestingApproval and RequestedApproval events

These events are raised on content requesting approval in the IContentRepository implementations.

RequestingApproval

Raised: Before content saving and when Transition.NextStatus is _VersionStatus.AwaitingApproval__
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - requesting approval content's content link
    • Content - requesting approval content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

RequestedApproval

Raised: After content saving and when Transition.NextStatus is VersionStatus.AwaitingApproval
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - updated requesting approval content's content link
    • Content - updated requesting approval content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

RejectingContent and RejectedContent events

These events are raised on content rejecting in the IContentRepository implementations.

RejectingContent

Raised: Before content saving and when Transition.NextStatus is _VersionStatus.Rejected__
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - rejected content's content link
    • Content - rejected content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

RejectedContent

Raised: After content saving and when Transition.NextStatus is VersionStatus.Rejected
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - updated rejected content's content link
    • Content - updated rejected content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

CheckingOutContent and CheckedOutContent events

These events are raised on content checking out in the IContentRepository implementations.

CheckingOutContent

Raised: Before content saving and when Transition.NextStatus is _VersionStatus.CheckedOut__
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - checking out content's content link
    • Content - checking out content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

CheckedOutContent

Raised: After content saving and when Transition.NextStatus is VersionStatus.CheckedOut
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - updated checking out content's content link
    • Content - updated checking out content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

SchedulingContent and ScheduledContent events

These events are raised on content scheduling in the IContentRepository implementations.

SchedulingContent

Raised: Before content saving and when Transition.NextStatus is _VersionStatus.DelayedPublish__
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - scheduling content's content link
    • Content - scheduling content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

ScheduledContent

Raised: After content saving and when Transition.NextStatus is VersionStatus.DelayedPublish
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - updated scheduling content's content link
    • Content - updated scheduling content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

DeletingContent and DeletedContent events

These events are raised on content or content's children deleting in the IContentRepository implementations.

DeletingContent

Raised: Before content deleting or content's children deleting
Arguments:

  • DeleteContentEventArgs with:
    • ContentLink -
      • content's link without version when raised from IContentRepository.Delete
      • content's link when raised from IContentRepository.DeleteChildren
    • TargetLink -
      • default value when raised from IContentRepository.Delete
      • content's link when raised from IContentRepository.DeleteChildren
    • RequiredAccess - access level passed into delete method
    • DeletedDescendents - content's descendant links

DeletedContent

Raised: After content deleting or content's children deleting
Arguments:

  • DeleteContentEventArgs with:
    • ContentLink -
      • content's link without version when raised from IContentRepository.Delete
      • content's link when raised from IContentRepository.DeleteChildren
    • TargetLink -
      • default value when raised from IContentRepository.Delete
      • content's link when raised from IContentRepository.DeleteChildren
    • RequiredAccess - access level passed into delete method
    • DeletedDescendents - content's descendant links
    • Items["DeletedItemGuids"]
      • content's Guid and its descendant Guids when raised from IContentRepository.Delete
      • content's descendant Guids when raised from IContentRepository.DeleteChildren

CreatingContentLanguage and CreatedContentLanguage events

These events are raised on content new language branch creating in the IContentRepository implementations.

CreatingContentLanguage

Raised: Before content saving if a new language branch is created
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - created content's content link
    • Content - created content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

CreatedContentLanguage

Raised: After content saving if a new language branch is created
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - updated created content's content link
    • Content - updated created content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

DeletingContentLanguage and DeletedContentLanguage events

These events are raised on content language branch deleting in the IContentRepository implementations.

DeletingContentLanguage

Raised: Before deleting a language branch
Arguments:

  • ContentLanguageEventArgs as ContentEventArgs with:
    • Content - deleted language branch content
    • ContentLink - deleted language branch content's content link
    • Language - deleted language branch language
    • MasterLanguage - deleted language branch master language
    • RequiredAccess - access level passed into delete method

DeletedContentLanguage

Raised: After deleting a language branch
Arguments:

  • ContentLanguageEventArgs as ContentEventArgs with:
    • Content - deleted language branch content
    • ContentLink - deleted language branch content's content link
    • Language - deleted language branch language
    • MasterLanguage - deleted language branch master language
    • RequiredAccess - access level passed into delete method

MovingContent and MovedContent events

These events are raised on content moving including moving to wastebasket in the IContentRepository implementations.

MovingContent

Raised: Before moving content
Arguments:

  • MoveContentEventArgs as ContentEventArgs with:
    • ContentLink - moving content's content link without version
    • TargetLink - destination content's content link
    • OriginalParent - original parent content's content link
    • Descendents - content's descendant content links
    • Content - moving content

MovedContent

Raised: After moving content
Arguments:

  • MoveContentEventArgs as ContentEventArgs with:
    • ContentLink - moving content's content link without version
    • TargetLink - destination content's content link
    • OriginalParent - original parent content's content link
    • Descendents - content's descendant content links
    • Content - updated moving content

CreatingContent and CreatedContent events

These events are raised on content saving and copying in the IContentRepository implementations.

CreatingContent

Raised: Before content saving if a new content is created including during copying
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - created content's content link
    • Content - created content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method
  • CopyContentEventArgs as ContentEventArgs on copying with:
    • ContentLink - empty content link
    • SourceContentLink - source content's content link
    • TargetLink - destination content's content link
    • RequiredAccess - access level passed into copy method

CreatedContent

Raised: After content saving if a new content is created including during copying
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - created content's content link
    • Content - created content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method
  • CopyContentEventArgs as ContentEventArgs on copying with:
    • ContentLink - created content's content link
    • SourceContentLink - source content's content link
    • TargetLink - destination content's content link
    • RequiredAccess - access level passed into copy method

SavingContent and SavedContent events

These events are raised on content saving in the IContentRepository implementations. These events are always raised before one of the other saving events like PublishingContent and PublishedContent.

SavingContent

Raised: Before content saving
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - saved content's content link
    • Content - saved content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

SavedContent

Raised: After content saving
Arguments:

  • SaveContentEventArgs as ContentEventArgs with:
    • ContentLink - updated saved content's content link
    • Content - updated saved content
    • SaveAction - save action passed into save method
    • Transition - evaluated transition based on content and save action
    • RequiredAccess - access level passed into save method

DeletingContentVersion and DeletedContentVersion events

These events are raised on content's version deleting in the IContentVersionRepository implementations.

DeletingContentVersion

Raised: Before deleting content version
Arguments:

  • ContentEventArgs with:
    • ContentLink - deleting content version content's content link
    • RequiredAccess - access level passed into delete method

DeletedContentVersion

Raised: After deleting content version
Arguments:

  • ContentEventArgs with:
    • ContentLink - deleting content version content's content link
    • RequiredAccess - access level passed into delete method

continue reading on author's website: Click here


Comments