Visit our SharePoint Forum

SharePoint developer? Submit Yourself as Freelancer

Monday, June 16, 2008

Creating and Deploying Event Reciver Feature with Solution package

See the new version @ Create and deploy Event Receiver Feature and Solution package

Requirenment was to fill in the value for Title column when a new item is added. The receiver was for calendar List(Templete Id 106).
Title coulmn should be filled in with pattren "CourseTitle( StartDateTime )" where CourseTitle was a Lookup field and StartDate Time was a default Start time field for Events List.

1. Create a C# class Library Project.
2. Add Microsoft.sharepoint as reference.
3. Write the following Code for ItemAdded Event in class library project.

4. Sign the Project with a unique key and Build the Project.
5. Create a folder caled Featurefolder and create a xml file in that. Name the file as "EventReciversElement.xml".

6. The code for Elements file is below:

7. Create Another xml file in the same folder(Featurefolder) name it as feature.xml.
8. Below is the code for Feature.xml.

9. Now we will create a solution Package to bind this feature.
10. For creating solution package we need to create manifest.xml file.

11. Lastly, we need .ddf file to tell how to arrange the files(elements.xml,feature.xml,dll,aspx pages or images) in a solution .cab project.

12. Add a Text file and name it as EventReciver.ddf. Write the following text in ddf file :

.OPTION EXPLICIT ; Generate errors

.Set CabinetNameTemplate =EventReciver.wsp; //name of soultion package

.Set DiskDirectoryTemplate=CDROM; All cabinets go to same folder

.Set CompressionType=MSZIP; //All files compressed in cabinet files

.Set Uniquefiles="ON"

.Set Cabinet=no

.Set DiskDirectory1 = Package

manifest.xml manifest.xml

Featurefolder\feature.xml Featurefolder\feature.xml

Featurefolder\EventReciversElement.xml Featurefolder\EventReciversElement.xml

bin\Debug\EventReciverFeature.dll EventReciverFeature.dll

13. open the command prompt and navigate to the EventReciverFeature folder.

write makecab.exe /f EventReciver.ddf to create a .wsp file in a package folder in EventReciverFeature folder.

14. Deploy this solution with stsadm.exe in sharepoint enviornment.

See the new version of this post @ Create and deploy Event Receiver Feature and Solution package


Dheeraj said...

Very informative blog

Isha kapoor said...

Thanks :)

Ross said...

using STSDEV would be the best choice...

Anonymous said...
This comment has been removed by a blog administrator.
Nirmal J. Shah said...
This comment has been removed by a blog administrator.
Sharepoint said...

Submit Yourself as Freelancer @

SharePoint Programming