With SharePoint 2010 SP1 the Site Recycle Bin feature was introduced. When a site is deleted it appears in this recycle bin. From there the user can restore the site.
Now, my problem is that I need to get programmatically informed when a site is restored out of this recycle bin by a user. Actually, if have to modify some properties on this restored site.

Any hints?

4 Answers 4


There is a post which details about a custom web part which can search the recycle bin items-


  1. Add this web part into a custom page and the results could be displayed in a grid, where each site or entity could be checked(using a checkbox) and restored by click of a button.

  2. While restoring, an email alert could be used to acknowledge that the site is restored.


I think you will need to have some algorithm for it. Below is one which may help:

  1. Maintain the deleted sites Url and GUID in a list.You can do it using SPWebEventReceiver.WebDeleted.Also,Before it gets deleted, modify its home page to a new html like page that says "Under Construction".

  2. Create a job and monitor the list for deleted site restoration. To do this, Go over the Urls(in the list) one by one and check if the any site comes into existence at that Url.

  3. If Yes, check if the GUID of the existing site equals to the GUID you stored for the deleted site at that URL.
  4. If Yes, this site is restored from recycle bin. Process the site further as you want.Restore its home page back to original so that user can access it.Remove its URL from the list that the job monitors.

Edit : You can also provide a custom page which will be used to restore from SPSite.RecycleBin .In code you can use SPDeletedSite.Restore() followed by your code to process the site.

  • Thank's for your suggestion. I will check this out. There are some considerations about performance and avoiding having artifacts in the list.
    – Matthias
    Commented Dec 2, 2011 at 9:31
  • How should I monitor the SPDeletedSite objects in the SPSite.RecycleBin? How do I get the restored sites, since they won't be there anymore.
    – Matthias
    Commented Dec 2, 2011 at 9:32
  • Regarding performance via lists, I don't think it is problem if you design the solution properly.Regarding,SPDeletedSite see my edit above Commented Dec 2, 2011 at 10:01

How about using an EventReceiver? You can catch several SPWeb events with it, I know that it works for creating a new Site and deleting it. Further information can be found here:


Im currently testing if the event will also be thrown if you restore a site from the recycle bin and give you a feedback in a few minutes.

  • I have already checked this out, but no luck. I did attach an SPWebEventReceiver to the SPWeb, but there was no event fired as far as I could see.
    – Matthias
    Commented Dec 1, 2011 at 10:42
  • How about WebProvisioned and yes it should be attached at site collection level as that's where the addition happens. Commented Dec 1, 2011 at 19:31
  • WebProvisioned happens when a site is provisioned, i.e. created. Restoring a site creates nothing, just restores the content as it was without applying any web templates or activating any features.
    – James Love
    Commented Dec 6, 2011 at 8:17

The Recycle bin is a list Item? Probably get a workflow to kick off to send you an email or can you create alerts to changes to the list?



  • No it is not a list item. It is a site (SPWeb).
    – Matthias
    Commented Dec 1, 2011 at 10:07

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.