Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

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.

}
share|improve this answer
    
Yes, I know about GUID, but i need retrieve an old id of item, that located earlier in a list. –  andDaviD Jun 18 '12 at 9:35
    
it it really existing in the Recyle bin any more? –  Falak Mahmood Jun 18 '12 at 19:35
add comment
up vote 0 down vote accepted

See my correction in my question.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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