Welcome to MSDN Blogs Sign in | Join | Help

Chris Johnson

All about Chris Johnson, SharePoint Products & Technologies & Other Stuff.
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...

Posted: Monday, March 14, 2005 12:43 PM by chjohn
Filed under: ,

Comments

Eddie Garmon said:

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.
# March 14, 2005 1:51 PM

Chris Johnson said:

That is on my list of things to do next :)
# March 14, 2005 3:23 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker