This blog post will show how to integrate the RadFileExplorer control for ASP.NET AJAX to work with SharePoint 2010 libraries. If you need a version for MOSS 2007, take a look at this earlier post.
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/rename items, preview, etc.). The default behavior of the control is limited to virtual folders that can be mapped to physical locations on the server's drives. SharePoint 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 a RadEditor for SharePoint 2010 version. The Editor and FileExplorer controls share the same content provider model. Here are the three steps you need to make to integrate the Telerik AJAX explorer in a SharePoint visual web part:
1. Deploy the Telerik.Web.UI assembly in the SharePoint 2010 server's GAC. Follow the instruction provided in the following help article: Install Telerik SharePoint Acceleration Kit.
2. 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 visual web part project for Visual Studio 2010, 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). The sample project uses the 2011.1.413.35 release of RadControls for ASP.NET AJAX to build and test the web part. The Telerik.Web.UI.dll assembly is not included in the attached project archive.
Link to sample project
Iana Tsolova is Product Manager at Telerik’s DevTools division. She joined the company back in the beginning of 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of the ASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web development, reading articles related to geography, wild nature and latest renewable energy technologies.
Subscribe to be the first to get our expert-written articles and tutorials for developers!