简体   繁体   中英

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

将事件接收器附加到 sharepoint 中的自定义列表需要哪些步骤?

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 .

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.

您可以转到元素文件并编辑标签 Receivers,将属性 ListUrl 的值更改为您的 URL,例如,如果您的列表名为客户,请插入<Receivers ListUrl="Lists/Customers">试试这个,祝你好运

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM