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

  • Can you post your whole elements.xml here , bcoz <Receivers ListTemplateId="101"> is the correct way. – Unnie Jun 2 '14 at 15:40
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, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.