Tuesday, September 1, 2009

SharePoint feature to extend SharePoint site with AJAX 3.5 and Telerik Rad Controls

Introduction

When I started to play with Telerik Rad controls under SharePoint, I realized, that the massive changes should be made manually to web application's web.config file. Therefore the DeploymentFeature application was created. It presents the SharePoint feature, which applies all needed changes to the web application's web.config file. Moreover it installs needed dlls to the GAC.

In general this application can add any modifications to the web.config, by reading them from an external XML file, which has structure similar to web.config. Moreover, since the modifications are located externally, they can be dynamically changed, without recompiling the application.

Prerequisites

The usage of the solution implies the SharePoint 2007 existence, which means that the target OS is Win2003 or Win2008.

The source code project was created using SPVisualDev, which uses WSPBuilder for deployment. So you should download and install them from CodePlex, or deploy and activate SharePoint feature manually. (Those tools are really helpful for development and deployment SharePoint projects).

Also, since the Telerik Rad controls, were the target, the application implies, that controls are installed and looking for them at c:\Program Files\Telerik\RadControls for ASPNET AJAX Q1 2009\Bin35\. However it's not a problem if the controls aren't installed or installation path is different, since this information is stored in external XML file and can be easily changed.

Using the Code

There are two classes in the solution:

  • Installer - applies all needed change and install the dlls into the GAC. Works in two modes Deploy and UnDeploy, which apply or remove changes respectively.
  • FeatureEventReceiver - traps the activation, deactivation, installation and uninstallation of SharePoint feature. When the feature is activated, it calls the Installer in Deploy mode and run the Installer in UnDeploy mode for modifications removal.

FeatureEventReceiver

Look into FeatureActivated method:


See full detail: http://www.codeproject.com/KB/sharepoint/SharePoint_Telerik.aspx