Wednesday, April 23, 2008

Steps for creating features

1. create a directory structure in visual studio as follows
Featues / "<"featuesname">" / feature.xml
Add schema to feature.xml from loc -">" web server xtn\12\template\xml\wss12.xsd
"<"feature ID=”” Title=”” Description= “” Scope = “” Hidden=”false”
"<"feature id="””" title="””" description="“”" scope="“”" hidden="”false”"">" "<"!-Note users cant activate or deactivate the feature only admin can-">"
"<"elementmanifests">"
"<"elementmanifest location="”Elements.xml”"">"
"<"elementmanifests">""<"elementmanifest location="”Elements.xml”"">"
2. Add new file Elements.xml
"<"elements">""<"elements">"
"<"module name="””" path="”url”"">"
"<"file url="””" type="”Ghostable”"">"

3. Inherit from SPFeatureReceiver class
Override the events FeatureInstalled, FeatureActivated,
Featureuninstalled, Featuredeactivated, Featureuninstalling, Featuredeactivating
4. put the DLL in GAC
5. In feature.xml ad these tags
"<"Feature ID=””
ReceiverClass=
ReciverAssembly=

Steps for Creating Item Event Handlers

  1. Open VS 2005 -> Select a class Library project -> Name it ____Handlers.
  2. Inherit the class from SPItemEventReceiver.
  3. override ItemAdded, ItemUpdated (Asynchronous Events)
    Item Adding, ItemUpdating (Synchronous Events)
  4. Install the DLL in GAC
  5. There are Two ways to register an Event Handler a. Install Features b. Through code
  6. To Register through code -> Open new console project
    Open site -> web -> get the list through code use the following method to register
  7. List.EventReceivers.Add(, , );