Deleting referenced items with a workflow

Build 1501 on 14/Nov/2017  This topic last edited on: 20/Jan/2014, at 14:03

In a code workflow that is supposed to spike objects and unlink them (unref them) if they are linked, with the following code:

      Dim spike As Spike = New Spike(Context) With {.Name = "spike"}
      spike.ObjectIds = searchResult.IdsOut
      spike.Unref = "pubDest.objs,package.objs,document.images" ' unpublish them as well...
      Dim spikeResult As SpikeResult = spike.Do()

...an error is displayed instead:

It is not possible to delete image 'BOOK Book Reviews 3' (id: 1086454) 

because it is referenced by: story '231113 - Book Review' (id: 1187153) (ERR0230)

It is not possible to delete image 'TRAVEL Arctic Circle 140451' (id: 1015114) 

because it is referenced by: document '034FE0911CWA' (id: 1069478) (ERR0230)

... while when attempting spike with:

srv4 spike –ids … -unref “pubDest.objs,package.objs,document.images”

... the spike is successful.

The possible reason may be that the folder where the images are is associated to a partition, that has an expiration rule. To verify it, run the Administrative Browser and in Expiration & Versioning check how the expiration rule is configured. This because an expiration rule can launch a workflow - if its spikeCode = to <Not Set>.