Domanda

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?
Thanks!

È stato utile?

Soluzione

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

http://allaboutmoss.com/2011/11/04/recycle-bin-search-webpart-for-sharepoint/

  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.

Altri suggerimenti

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.

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:

http://msdn.microsoft.com/en-us/library/gg252010.aspx

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.

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?

Cheers

Aben

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top