you can do this with a custom processor:
namespace Website.Pipelines
{
public class UnpublishArchivedItem : DeleteItems
{
public void Process(ClientPipelineArgs args)
{
Assert.ArgumentNotNull(args, "args");
Database database = Factory.GetDatabase(args.Parameters["database"]);
Assert.IsNotNull(database, typeof(Database), "Name: {0}", args.Parameters["database"]);
ListString listStrings = new ListString(args.Parameters["items"], '|');
Database target = Factory.GetDatabase("web");
foreach (string listString in listStrings)
{
Item item = database.GetItem(listString, Language.Parse(args.Parameters["language"]));
if (item == null)
{
continue;
}
Log.Audit(this, "Unpublish item: {0}", new string[] { AuditFormatter.FormatItem(item) });
item.Editing.BeginEdit();
item.Publishing.NeverPublish = true;
item.Editing.EndEdit();
PublishManager.PublishItem(item.Parent, new []{ target }, item.Languages, true, false);
}
}
}
}
This will set your archived item as unpublishable and will be removed from the "web" database.
Alternatively, you can remove directly the item from the web database using the item.Delete() method but personally, it's not optimal because you need to update your indexes.
Then, create a config file to define your processor and insert it before the item is archived, which is the Execute method.
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<processors>
<uiArchiveItems>
<processor type="Website.Pipelines.UnpublishArchivedItem,Website" patch:before="*[@method='Execute']" />
</uiArchiveItems>
</processors>
</sitecore>
</configuration>
Try this and let me know if it worked.