Custom validation for «Manage Expiration and Archiving».


I am well aware of how custom validation of regular properties can be done, but how can I validate the input in the window for «Manage Expiration and Archiving»?

I would like to make «Archive to» required for some page types, if «Expire date» has a value.

I have tried adding this:

public class ExpirePageValidator : IValidate
    IEnumerable IValidate.Validate(ExpirePage page)
        if (page.StopPublish != null && page.ArchiveLink == PageReference.EmptyReference)
            return new[]
                new ValidationError
                    ErrorMessage = "Varför gör ni på detta viset?",
                    PropertyName = page.GetPropertyName(page => page.ArchiveLink),
                    Severity = ValidationErrorSeverity.Warning,
                    ValidationType = ValidationErrorType.AttributeMatched
          return Enumerable.Empty();

The code runs when the expiration date are saved, but the validation message are not shown until other changes are published. Most of the time there are no other changes, so the validation message will never be shown.

How can I solve this?

Edited, Apr 07, 2017 15:24

Have you seen this recent blog post

I am not 100% sure about if will work for you, but this can give you heads-up. Best of luck :)

Nov 23, 2019 4:18

the closest I got was using IContentEvents. it of course look like page is expired (updated UI + yellow bar), but editor will also see validation error (if you cancel ContentSavingEvent)..

couldn't find better way

Nov 25, 2019 12:53

i would love to have events on expiry, its strange they dont exist now, expiry goes around the publishing process, would be great if Epi could pick this up as a feature enhacement to allow hooks into expiry for validation etc

Nov 26, 2019 12:55

Please submit your enhancement request to

Nov 26, 2019 17:46

Validation for Manage Expiration and archiving can be done by below methods:

  1. Create a custom class let say CustomEventInitialization implementing interface IInitializable Module.
  2. Resolve dependency for interface IContentEvents.
  3. Register your publishing event in Initialize method.
  4. Then in your publishing event method check for : page.StopPublish date
  5. On basis of your business conditions , you can use vallidations now on the basis of event properties.
  6. event.CancelReason = "validation message", event.CancelAction =true/false.
Mar 29, 2021 14:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.