Multiple document library event handlers on a library
Ever wanted to do this? ... Me too!
Unfortunately there is not a nice way to do this... however if you are able to modify the code there is a way to string a few of them together.
Take the first document library event handler, inherit from the second. Add your code to do what ever you need to. Call your base class.
E.g:
public class MyHandler : SecondHandler, IListEventSink
{
.
.
.
public void OnEvent(SPListEvent event)
{
base.OnEvent(event);
}
}
I mean this hack ... but it will allow you to have a few handlers with separate code etc...
Comments
- Anonymous
March 14, 2005
Why not write a generic handeler that has an internal collection of handlers.
then...
public void OnEvent(SPListEvent event) {
foreach (Handler handler in collection) {
handler.OnEvent(event);
}
}
this way you dont have any dependancy between handlers, and you can dynamically add and re-order them. - Anonymous
March 14, 2005
That is on my list of things to do next :)