Hot answers tagged event-receivers
You cannot add an event receiver through the "Add new project" dialog. What you do is create an empty sharepoint project first. Then just right click on said sharepoint project, click add new item, go to Office/SharePoint and choose Event Receiver. See my screenshot.
There are a couple of ways you can do this from the event receiver. The nice thing about an an event receiver is that you can get the instance of the list that the receiver is working on and from there easily access the Items Collection. From there you can iterate through the list and perform a check by item. There are plenty of tutorials to show you how ...
Try to get all resources and objects that you need from the recently opened SPWeb and SPSite objects. Avoid getting them from the receiver properties once you have your code running under elevated privileges, like on this line: SPDocumentLibrary docLib = (SPDocumentLibrary)properties.List; Try this instead: SPDocumentLibrary docLib = ...
Only top voted, non community-wiki answers of a minimum length are eligible