5

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.

[EDIT]

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.

3 Answers 3

3

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.

1
  • Why the downvote?
    – Emaborsa
    Commented Nov 15, 2017 at 14:24
2

SPRecycleBinItem.ID is not same as deletedItem.UniqueID. I have checked it. So you can't use them to identify deleted item in recycle bin. You can expiriment with DirName and LeafName, but there at least 3 different cases: item is folder, item is file, item is ordinary item.

0

The SPRecycleBinItem has the unique GUID which is the same before and after deletion. Therefore, you can retrieve it using the code below:

SPRecycleBinItemCollection itemColl = web.GetRecycleBinItems(q);
foreach (SPRecycleBinItem item in itemColl)
{
    Guid[] id = new Guid[1];
    id[0] = item.ID; //Gets the GUID of the item.

}
2
  • Yes, I know about GUID, but i need retrieve an old id of item, that located earlier in a list.
    – andDaviD
    Commented Jun 18, 2012 at 9:35
  • it it really existing in the Recyle bin any more? Commented Jun 18, 2012 at 19:35

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.