When I restore a list item from the normal recycle bin I can access the item using properties.ListItem. However, when restoring from the Site Collection recycle bin, the listitem is null?!
Ok, I thought, the SPItemEventProperties object I have also provides me with WebUrl, ListId and ListItemId so I can spin up a new SPSite with WebUrl, use openweb to get my SPWeb, use ListId to get the correct list and then the ListItemId to get the item.
A bit long winded but should get me where I need to be. This would be ok, but at runtime I got an exception list not found. On investigation it seems the WebUrl property is wrong. I've run this on a few different lists/sites and it is consistently wrong! The
value I'm seeing is http://[webapp]/sites/[sitecol]/sites/[sitecol]/[web]. Note the repitition of /sites/[sitecol]?!
This is really frustrating and very poor. So not only is the ListItem property null(?), but there is no easy way to get the list item manually! Does anyone else see this behaviour? Sharepoint is really testing my sanity this week!
View Complete Post