When you remove an older version of a component from its history in Tridion, it seems it will trigger the event system's OnComponentDeletePost method.

We have a situation where removing components of a certain schema type in the GUI will also remove some other components related to this component. This is good, but should not occur when items are removed from the component's history, such as when running the purge tool.

Is there any way to detect a component was fully deleted or if a version was deleted in its history when running code in an event system's OnComponentDeletePost method?

2 Answers 2


Well, before the execution of any code in event handler. You should check the version of the component.

You can get the version of a component by component.Version.

I haven't run the code for this but I guess it should work.


As correctly pointed out by @Rick in the comment. the version 0 represents the checked out version of the component. So Please use component.Id.IsVerionless to check the version less item.

Thanks Rick

  • 6
    Agree that you should check the version of the item to be deleted, but version 0 does not represent the latest version of an item, but the checked-out/editable/dynamic version. That version (which only exist if the item is checked-out) cannot be deleted. You can dinstinguish delete of an entire item from a specific version by the lack of a version number in the items TCM URI (component.Id.IsVerionless) Commented Dec 15, 2014 at 19:35

Rick's comment under Saurabh's seems to be the most appropriate one. Checking for the Component.Id.IsVersionLess flag will give you the info to distinguish between a delete action from the explorer or from the component's history.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.