kamagra how much to take

Dumping Dated SharePoint Recycle Bins [Fix]

For whatever rationale, typed iterations to dump particular SPRecycleBinItem objects out of the SharePoint recycle bin don’t work due to a problem with the proc_DeleteRecycleBinItem stored procedure.  But it seems to be indeterminate and I can’t locate any sort of thresholds.

So, for some reason:

  1. public static void NonWorkingRecycleBinDump(string url)
  2. {
  3. using (SPSite site = new SPSite(url))
  4. {
  5. using (SPWeb web = site.OpenWeb())
  6. {
  7. SPRecycleBinItemCollection coll = site.RecycleBin;
  8. foreach (SPRecycleBinItem item in coll)
  9. {
  10. item.Delete();
  11. }
  12. }
  13. }
  14. }

will not work in some environments, with certain items. I cushion the claim with the some because my testing has been limited to my VM, some production stuff, and the SharePoint support engineer’s VM I am talking to. It’s nonetheless a frustrating problem to run into.

It should be noted that this apparently isn’t the case however when using the SPWeb.RecycleBin.DeleteAll() if you are doing a complete dump, as detailed here:


The final solution to the aforementioned problem is documented here:


However, this doesn’t take into account hydrating specific DateTime objects. In order to introduce this functionality, we just have to modify this code slightly. In this case, through the use of the DateTime.Compare method, we can remove certain logs based on their DeletedDate property.

  1. public static void WorkingRecycleBinDump(string url)
  2. {
  3. using (var site = new SPSite(url))
  4. {
  5. using (SPWeb web = site.OpenWeb())
  6. {
  7. SPRecycleBinItemCollection coll = web.RecycleBin;
  8. for (int x = 0; x < coll.Count; x++)
  9. {
  10. var ids = new Guid&#91;1&#93;;
  11. DateTime deletedTime = coll&#91;x&#93;.DeletedDate;
  12. DateTime selectedTime = &#91;your DateTimeObject&#93;;
  13. if (DateTime.Compare(selectedTime, deletedTime) > 0)
  14. {
  15. ids[0] = coll[x].ID;
  16. coll.Delete(ids);
  17. }
  18. x = x - 1;
  19. }
  20. }
  21. }
  22. }

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>