About      |       Articles      |      Services      |      Software      |      Contact

Latest Free SharePoint Software

ARB Security Solutions regularly releases free SharePoint software, including WebParts, Client Applications, Framework Extensions, and other Miscellaneous Components.
The most recent freeware is:

Title: Simple SharePoint Rollup WebPart
Date Published: 10/22/2009

Previous Two Free WebPart Releases:

SecureCenter For SharePoint

By SharePoint security integrators, for SharePoint security integrators.

SharePoint Security Assurance Program™

For externally facing SharePoint deployments, security is an acutely important deployment concern. Learn how through daily security scanning, you can ensure external business users and partners that they can collaborate in confidence!

Security Assurance WebPart:



Dump Recycle Bin Programmatically

At times, you may find that you wish to work with SharePoint recycle bins programmatically. I had a friend ask me this morning about approaches regarding dumping objects out of the recycle bin since he was experiencing storage issues disallowing deletion through the SharePoint web interface.

Working through the recycle bin through code is not a difficult task; there are a variety of object model pieces that you can use.

There are a few important ones:

SPRecycleBinItem - Represents an object in the Recycle Bin either at the site collection or site level

SPRecycleBinItemCollection - Represents a collection of SPRecycleBinItem objects

SPRecycleBinItemCollectionPosition - Represents the current page pointer of the recycle bin view

SPRecycleBinItemState - An enumeration containing the relevant SPRecycleBinItem object states, either FirstStageRecycleBin (site recycle bin) or SecondStageRecycleBin (site collection recycle bin)

SPRecycleBinItemType - An enumeration containing the SPRecycleBinItem object type, either:

Attachment
File
FileVersion
Folder
FolderWithLists
List
ListItem

SPRecycleBinOrderBy – Specifies the piece of order data when executing a query against against the recycle bin.

SPRecycleBinQuery – Specifies a query to run against the Recycle Bin in order to return SPRecycleBinItem objects

SPRecycleBinType – An enumeration containing the type of the Recycle Bin, either:

RecycleBin
SiteRecycleBin

So, how we can we use these to start working with the Recycle Bin? Fortunately, there are a variety of methods that the SharePoint API provides you in order to do so. For example, let’s assume that you wanted to dump all the SPRecycleBinItem objects for a site so that the Recycle Bin was then empty. We can build an SPRecycleBinItemCollection by creating a new SPWeb object which contains the RecycleBin collection, which allows a variety of method access. One of these methods includes the DeleteAll() method.

C#:
  1. using (SPSite site = new SPSite(“http://sharepointserver”))
  2. {
  3. using (SPWeb web = site.OpenWeb())
  4. {
  5. try
  6. {
  7. web.RecycleBin.DeleteAll();
  8. }
  9. catch (Exception exception)
  10. {
  11.  
  12. }
  13.  
  14. }
  15. }

  • Share/Bookmark

3 Comments »

  1. [...] Posted on March 26, 2008, 12:01 amby admin best video: 2007, foruser();    miami crane accidentworld of warcraft addons questUpward in 2007 – Chosun IlboAccording to the NSO, 345600 couples registered their marriages in 2007, the most since 1999. An NSO official said, &quotThe Year of the Dog started on Jan.security functions do indeed provide some levewww.sharepointsecurity.comCPI Aero posts profitable 2007, compared to &3906 loss – NewsdayCPI president and chief executive Edward Fred said in a statementbefore markets opened that 2007 marked &quota major turnaround&quot in the company&39s business. …www.newsday.comMore innings for closers?I’ve been playing with my league settings in order to get closers theoretically the best RP on a given team more innings. What I’m seeing is that the AI tends to wait for save situations for closers and, as such, they’re often throwing much fewer inningwww.ootpdevelopments.comFinancesWhat is the best way to fix finances from a 6.5 converted league? Here’s the problem: Just about every team is in the red as far as money for FAs, etc. There are a ton of great FAs available, but they’re just sitting in the FA pool because noone can siwww.ootpdevelopments.comIs there anybody alive out there?Season started today. A little news from the home front maybe?www.ootpdevelopments.com [...]

    Pingback by 2007, — March 25, 2008 @ 6:08 pm

  2. Hi.
    I’d like to implement custom pager using
    SPRecycleBin API’s.
    How can I use SPRecycleBinItemCollectionPosition ?

    Comment by shin tsukamoto — September 18, 2008 @ 12:21 am

  3. [...] http://www.sharepointsecurity.com/blog/sharepoint/sharepoint-2007-development/dump-recycle-bin-programmatically/ [...]

    Pingback by SharePoint Shelter » Blog Archive » Dumping Dated SharePoint Recycle Bins [Fix] — September 24, 2008 @ 8:31 am

RSS feed for comments on this post. TrackBack URL

Leave a comment