<CharlieDigital/> Programming, Politics, and uhh…pineapples


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:

public enum SPEventReceiverType {
ContextEvent = 0x7ffe,
EmailReceived = 0x4e20,
FieldAdded = 0x2775,
FieldAdding = 0x65,
FieldDeleted = 0x2777,
FieldDeleting = 0x67,
FieldUpdated = 0x2776,
FieldUpdating = 0x66,
InvalidReceiver = -1,
ItemAdded = 0x2711,
ItemAdding = 1,
ItemAttachmentAdded = 0x2717,
ItemAttachmentAdding = 7,
ItemAttachmentDeleted = 0x2718,
ItemAttachmentDeleting = 8,
ItemCheckedIn = 0x2714,
ItemCheckedOut = 0x2715,
ItemCheckingIn = 4,
ItemCheckingOut = 5,
ItemDeleted = 0x2713,
ItemDeleting = 3,
ItemFileConverted = 0x271a,
ItemFileMoved = 0x2719,
ItemFileMoving = 9,
ItemUncheckedOut = 0x2716,
ItemUncheckingOut = 6,
ItemUpdated = 0x2712,
ItemUpdating = 2,
SiteDeleted = 0x27d9,
SiteDeleting = 0xc9,
WebDeleted = 0x27da,
WebDeleting = 0xca,
WebMoved = 0x27db,
WebMoving = 0xcb

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).

Posted by Charles Chen

Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.