I'd like to distinguish between a scheduled unpublish action and an immediate unpublish action via the Event System. Is this possible?
2 Answers
In the UnPublishEventArgs
there is a member UnPublishInstruction
.
This will have a property - StartAt
- If StartAt property is set to DateTime.MinValue that means the Unpublishing is scheduled for Immediate unpublish and if it is set to a particular datetime, that means it is schedule to unpublish at some other time.
-
Realized after submit that a similar answer has already been submitted :P Commented Oct 11, 2013 at 8:44
Of course. UnPublishEventArgs
has property UnPublishInstruction
which in turn has StartAt
. So if StartAt
is set - it's scheduled action
-
4One small correction - the StartAt will always be set to some value - If it is set to DateTime.MinValue then the unpublishing is immediate and if it set to any other particular datetime, then it is schedule for some later time :) Commented Oct 11, 2013 at 8:45