raklos
raklos

Reputation: 28545

how to attach an event receiver to a custom list in sharepoint?

What are the steps required in attaching an event receiver to a custom list in sharepoint?

Upvotes: 3

Views: 16732

Answers (4)

Artur
Artur

Reputation: 149

All you have to do is replace the following line in Elements.xml:

<Receivers ListTemplateId="*number*">

with

<Receivers ListUrl="Lists/*your list name*">

Note that "Url" is written with only the first character capitalized

Upvotes: 0

Ahmed MEZRI
Ahmed MEZRI

Reputation: 534

you may go to element file and edit the tag Receivers, change the value of the attribut ListUrl to whatever is your URL for instance if your list is called Customers, insert <Receivers ListUrl="Lists/Customers"> Try this and good luck

Upvotes: 0

Flo
Flo

Reputation: 27455

There are several ways to attach EventReceivers to lists, ContentTypes or sites. Take a look at Brian Wilson's blog post about this topic and describes several ways to do this.

He also developed a SharePoint Feature which deploys a configuration page where you can attach and delete EventReceivers over an UI.

Upvotes: 1

Lance Perry
Lance Perry

Reputation: 1306

This can be done in at least two different ways:

  1. Create a feature that upon feature activation you have the proper code to attach to a specific list (use this URL for some help)
  2. Or you could have a console application that will have code to attach to a specific list (again using the same code as in the URL mentioned above)

For further help go here.

Upvotes: 1

Related Questions