How to publish or unpublish dam assets for a period of time in AEM?


As for the pages, using the on/off time properties in the way to go.

The mechanism behind the definition of an "on" or and "off" period for assets, is to trigger corresponding Activation or Deactivation request towards the publishers, in order to physically add, or remove the Asset on the instances.
This way, publishers won't be able to render the deactivated asset via any component or Asset Search feature during an "off" period.

To achieve this, the "On-/Offtime reached" trigger has to enabled on your standard replication agents, see this doc page (2) .

Use case example :

An asset must not be accessible during Monday the next week (let's say 20XX/07/22), between 8am and 7pm . The Asset is currently published.
- Set the off time to 20XX/07/22 at 08:00 and the ontime to 20XX/07/22 at 19:00 .

Thanks to the trigger, a Deactivation request will be issued at 8am on this day, removing the asset from publishers.
An Activation request will be sent at 7pm the same day, to make the Asset available again.

Note : the same trigger must be enabled on your dispatcher flush agents to invalidate the cache when the on/off time period boundaries are reached.