The RadFileExplorer is a fairly new control in our ASP.NET AJAX suite and we are happy to see that a lot of people are already adopting it into their solutions. In this post I will show how to make the file explorer work with SharePoint libraries.
By default, the control interfaces with a virtual folder in your web application and allows you to do all kinds of file/folder operations (create new folders, upload/move/delete items, preview, etc.). Unfortunately, the default behavior of the control is limited to virtual folders that can be mapped to physical locations on the server's drives. MOSS web applications use "libraries" to store documents/images and these libraries are only available from the SharePoint database - the files are not stored as physical files on the server, they go in the database instead.
Using the RadFileExplorer in SharePoint web applications will require a new file browser content provider (the logic that connects the file explorer UI to the actual files/folders). Fortunately, we already have such a provider - the RadEditor control uses the RadFileExplorer in its dialogs and we have had a MOSS RadEditor version for some time now. The Editor and FileExplorer controls share the same content provider model. Here are the three steps you need to make to integrate the explorer in a SharePoint web part:
- You need to make sure that you have enabled the ASP.NET AJAX Extensions in your MOSS web application - http://www.telerik.com/help/aspnet-ajax/moss-install-aspnet-ajax.html
- Next you need to deploy the Telerik.Web.UI assembly in the MOSS server's GAC. This way you can use the RadControls in your site collections - http://www.telerik.com/help/aspnet-ajax/moss-deploying-radcontrols.html
- When you add the RadFileExplorer in your web part, you need to set the [RadFileExplorer].Configuration.ContentProviderTypeName property to the SPContentProvider class.
I am attaching a simple SharePoint web part project for Visual Studio 2005, which includes the SPContentProvider class. If you have already done steps 1 and 2 above, you can deploy this project and the FileExplorer web part will show you all libraries in the current site and allow you to interact with them (if you have the required permissions for the libraries of course). I used the 2009.1.527 release of RadControls for ASP.NET AJAX to build and test the web part. FileExplorer_MOSS_WebPart