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.

Tuesday, February 21, 2006

SharePoint Migration utilities

I've been getting really annoyed with the SharePoint 2003 / WSS migration utilities (StsAdmin and SMigrate). I decided it would be much easier to build a GUI around some of their features. The source code and application are available here:

Downloads:

Download
Exe only
Download Exe and source code

Screenshots:

The Logon screen allows you to impersonate another user.

Main application

The application displays 4 tabs: Backup, Restore, Web Part Packages, and Templates.

The Backup tab allows you to use SMigrate to backup a site in SPS or WSS. This will not extract areas from SPS.

The Restore tab allows you to use SMigrate to restore a site in SPS or WSS.

The Web Part Packages tab allows you to use StsAdm to view, add, or remove web part packages from a SPS or WSS site. First, set the url. Then click the List Items button to view all web part packages on the site. You must be an administrator for this function to work. In some cases, you may have to be the single portal administrator account that runs the application pool.

The Templates tab allows you to use StsAdm to view, add, or remove list templates from a SPS or WSS site. First, set the url. Then click the List Items button to view all templates on the site. You must be an administrator for this function to work. In some cases, you may have to be the single portal administrator account that runs the application pool.


Finally, after performing some actions, you will be prompted to perform an IIS Reset. This is available in the menu as shown in the following diagram: