I need know old id of item in recycle bin or is there any way how to save its id in this item before deleting. When item is deleted, a new SPRecycleBinItem is created in Recycle Bin. And the only saved information about old item is DirName. But I need know more information.

2 Answers 2


I have solved this issue. There is such property as LeafName in SPRecycleBinItem, which is the same as earlier Id in SPListItem for files (not for folders). If SPListItem was a file, then its LeafName would be "id" + "_.000" after deleting; If SPListItem was a folder, then its LeafName would be earlier Name of SPListItem.


Well, you can of course save an items ID in an event receiver when deleting it and store it where you can relate it to an item in the recycle bin.

However, by the sound of this I think you're using an Item ID as a primary key, and have now run into the problem of the ID changing. Using item ID as a key is a very bad idea, as it will change when doing item level restore through backup tools, when recycling it, and depending on how you use it; with version control.

TL;DR - Yes, you can use an event handler to store the ID before recycling, but using the ID for anything is a really bad idea.

  • Yes, I can save GUID of deleted items, but this collection of GUIDs will never be cleaned, when item is deleted from Recycle Bin.
    – andDaviD
    Jun 18, 2012 at 13:39
  • Fairly sure that ItemDeleting, if connected to the content type, is fired when you remove something from the recycle bin. Not 100% sure, but you should check.
    – Tobias
    Jun 19, 2012 at 6:58
  • I have already checked it. There aren't any EventReceivers for Recycle Bin. Developers of sharepoint didn't create them (
    – andDaviD
    Jun 19, 2012 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.