Question

we have a custom expiration action where we copy an item to a list. Then we want to delete the source item (as provided as parameter in OnExpiration method).

When we call item.Delete(), then the iteration through the expired items stops and we have this in our log files:

Error processing expiration of content in list FinDoc in site https://xxx.blabla.com/sites/12345. Error: Microsoft.SharePoint.SPException: Het item bestaat niet. Mogelijk is het door een andere gebruiker verwijderd. (== item does not exist, possibly it has been deleted blablabla.) at Microsoft.SharePoint.SPListItem.EnsureItemIsValid() at Microsoft.SharePoint.SPListItem.GetValue(SPField fld, Int32 columnNumber, Boolean bRaw, Boolean bThrowException) at Microsoft.SharePoint.SPListItem.get_Url() at Microsoft.Office.RecordsManagement.PolicyFeatures.ExpirationTask.<>c__DisplayClass19.b__18(SPListItem item, Exception e) at Microsoft.Office.Server.Utilities.ContentIterator.ProcessItem(SPListItem item, Boolean fIncludeFolderItems, MonitoredScopeWrapper monitoredScopeWrapper, ItemProcessor itemProcessor, ItemProcessorErrorCallout errorCallout) at Microsoft.Office.Server.Utilities.ContentIterator.ProcessItems(SPListItemCollection items, Boolean fIncludeFolderItems, Boolean fIterateInReverseOrder, MonitoredScopeWrapper monitoredScopeWrapper, ItemProcessor itemProcessor, ItemProcessorErrorCallout errorCallout) at Microsoft.Office.RecordsManagement.PolicyFeatures.ExpirationTask.<>c__DisplayClass11.<>c__DisplayClass13.<>c__DisplayClass15.b__c(SPListItemCollection items) at Microsoft.Office.Server.Utilities.ContentIterator.ProcessListItems(SPList list, SPQuery query, ItemsProcessor itemsProcessor, ItemsProcessorErrorCallout errorCallout)

It seems that, after running the OnExpiration, SharePoint internally still want to do some things on the item (but it's deleted by then of course). Can we prevent this? Or is it impossible to delete the item using item.Delete() in the OnExpiration method?

I am quite sure, that we have done this before and that all worked as expected.

Anyone has some suggestions?

Was it helpful?

Solution

There is not a lot information to find on this one but it seems that implementing IExpirationWithPostActions (https://msdn.microsoft.com/EN-US/library/office/microsoft.office.recordsmanagement.policyfeatures.iexpirationactionwithpostactions.onexpirationwithpostactions.aspx) helped me out

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top