Wednesday, March 28, 2007

Event handler in Document Library

When working with event handlers in SharePoint, the event handlers will usually be associated with different lists. Using lists like a Task list or a Custom list and using the item adding event will present the developer with the SPItemEventProperty object as an argument. This object holds the information a developer can work with such as the ListItem property which will return the SPListItem that fired the event in question.

A problem arose when I tried making an event handler for a document library. Overriding the ItemAdding method, thus gaining access to the SPItemEventProperty, I found that this object returns a null exception. When debugging the event handler I saw that the SPItemEventProperty was in fact null. This is quite interesting since the event handlers are working on other list types.

After a few hours looking for information about this problem, non had come up with a sloution. One way to get around the problem should be to directly adress the column of interest in the listitem, like such:

  property.ListItem[columnName]

However, this I did not get to work either, still getting the nullException when running the event.

This issue  is still under investigation. If anyone has an answer, please post a repsonse.

Best regards

Sebastian

Posted by Zeb at 17:42:54 | Permanent Link | Comments (0) |
Comments
Write a comment