Wednesday, February 22, 2006

Creating a Recycle Bin for Windows SharePoint Services WSS/SPS (Part 1)

In MSDN Magazine, there was an awesome article a few months ago about creating a recycle bin in WSS. However, not all of the information was provided to complete it successfully. This entry fills in the missing information from the MSDN Mag recycle bin article.

  • Configure WSS to allow Web Part Extensions
    To configure SharePoint, you need to enable event handlers. Go here for configuration instructions:
    http://msdn.microsoft.com/library/en-us/odc_SP2003_ta/html/sharepoint_wsseventing.asp

  • Configuring the Recycle Bin
    To make a document library work with the recycle bin, do the following to the recycle bin document library:
    1. Click "Manage Content" On the area home page and select the document library that requires the recycle bin.
    2. In "General Settings" click the link "Change advanced settings"
    3. In the section labeled "Event Handler" enter the following:
      • Assembly Name: My.SharePoint.RecycleBin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=publickeytoken
      • Class Name (Recycle Bin): My.SharePoint.RecycleBin.RecycleBinEventSink
      • Properties:
        <Data>
        <Mirror>Backup</Mirror>
        <Recycle>Recycle Bin</Recycle>
        <Domain>Domain</Domain>
        <User>PortalAdmin</User>
        <Pass>password</Pass>
        <Type>*</Type/>
        <Size>*</Size>
        </Data>
  • Configuring the Document Library
    Follow the same steps as above, but set the class name to My.SharePoint.RecycleBin.DocLibEventSink
  • Configuring the Recycle Bin All Items page
    The recycle bin document library does not have the proper menu structure to restore items from the page. Open the AllItems.aspx page either using front page or mapping the document library using Add Network Places... and add the javascript that came with the recycle bin source code (don't forget the <script> tag) between the tags at the top of the document.
  • Testing it out
    When you go to test out the recycle bin, don't be surprised if something isn't configured right--it takes a few tries. When you delete an item from the document library, it will create a folder in the Recycle Bin document libary that is the same name as the original document library--this allows the recycle bin to retain a reference point for restoration. Inside the folder, you'll see the file you deleted. The javascript you applied will make the drop down menu options be Restore and Delete. When you restore the file, it should return to the document library it came from.

In a future entry, I will go into implementing the document/recycle bin across all SPS/WSS webs. At least this entry covers the missing pieces from the MSDN Mag article.

2 comments:

Anonymous said...

Why not download the Blue Duck Recycle Bin addin for SharePoint Portal. It is free.

http://www.darkblueduck.com/

Suman Chakrabarti said...

Well, free is good, but if you want to customize it, there are very few locations to get information on how to do it.