0

I have many custom document libraries. I would like to create and attach an event receiver for all these Library. With <Receivers ListTemplateId="101"> they don't work. Any help is appreciated

1
  • Can you post your whole elements.xml here , bcoz <Receivers ListTemplateId="101"> is the correct way. Commented Jun 2, 2014 at 15:40

1 Answer 1

0

You can programatically attach the event receivers to your document library as

list = web.TryGetList("ListName");

 if (list != null) {
    list.EventReceivers.Add(SPEventReceiverType.ItemAdding, Assembly.GetExecutingAssembly().FullName, "Namespace.ClassName");

    list.Update();

Or you can create a content type and attach event receiver to that content type and after that add that content type to your document library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.