Contents
Create a Custom List Level Event Receiver For Item Added To SharePoint 2013
- Open Visual Studio 2013 and create an empty SharePoint Project.
- Enter the site URL and select Deploy as a Farm solution and click Finish.
- Open Solution Explorer and add a new item.
- Select event receiver and enter the title of the event receiver.
Run and test the event handler
- Select the F5 key to run the project.
- Trust the add-in when prompted to do so.
- Select the ID of List1.
- Select the Retrieve List Items button.
- In the Add Item box, specify First Item, and then select the Add Item button.
- Select the Refresh Lists button to return to the table of lists.
How to add event receiver to the list?
To add an event receiver to the list instance Open the project that you created in Walkthrough: Create a site column, content type, and list for SharePoint. In Solution Explorer, choose the SharePoint project node, which is named Clinic. On the menu bar, choose Project > Add New Item.
The following steps show how to modify a list item event receiver to respond only to events that occur in a custom announcements-list instance. In a browser, open the SharePoint site. In the navigation pane, Lists link. In the All Site Content page, choose the Create link.
How to create event receiver project in Visual Studio?
In a browser, open the SharePoint site. In the navigation pane, Lists link. In the All Site Content page, choose the Create link. In the Create dialog box, choose the Announcements type, name the announcement TestAnnouncements, and then choose the Create button. In Visual Studio, create an event receiver project.
Why does the event receiver not trigger on the new announcement?
Notice that the event receiver does not trigger on the new announcement because the receiver is configured to respond only to events in the custom announcement list instance, TestAnnouncements.