SharePoint “Feature”: Pain In The Ass…

Just to share some findings on working with SharePoint features:

  • The Elements.xml file that you include with your feature deployment cannot contain XML comments; if it does, you will encounter an error when you try to activate your feature using STSADM.exe.  Why?  Who knows.

  • The <type/> element in the Elements.xml file, according to the schema documentation, can only occur once.  This seems to imply that you will need a different Elements.xml file to subscribe to each event type that you want to handle.

  • And of course, Microsoft does not include the list of valid values (and if they do, it’s not easy to find in the documentation).  Instead, I pulled the values using Reflector from the SPEventReceiverType enumeration.

The following is the enumeration listing:

Of course, these values are in hexadecimal and for some reason, the <type/> element insists on the integer values.  So just be sure to convert the value to integer (try using Google for that).

You may also like...