When I manually archive an item which is referenced by other items Sitecore popup dialog box with Actions – how to handle the links.
If the item is configured for automatic archiving with “Set Archive Date” and it is archived seems that Sitecore is choosing by default “Leave Links” action, so all links to the archived item will be broken.
How/Where could I hooked up in order to stop archiving of item (scheduled archiving) which is referenced by other items? I would like to stop archiving and create some rapport that that archiving was not successful.
In order to prevent Sitecore from archiving linked items, you need to overrider 2 classes.
First of them is ArchiveItem so it’s checking whether item is linked before archiving it:
Second class which you need to override is SqlServerTaskDatabase so it schedules the overriden MyArchiveItem task instead of the original Sitecore ArchiveItem:
The last thing you need to do is to update Sitecore config to point at MySqlServerTaskDatabase:
The information about failed archiving attempt will be stored in log files. You may want to update this part to store it in your custom reports.
Below goes additional information which is not necessary for your original problem to work.
You can also hook before the schedule is set as described below to inform user that the item won’t be archived.
First create the class that will override ArchiveDateForm class:
Then find the file /sitecore/shell/applications/dialogs/archive item/archive date.xml. Change the 6th line to point at the new class:
And that’s it. Whenever one will try to schedule archiving of an linked item, Sitecore will display information that the item cannot be archived.