Book Image

Microsoft SharePoint 2010 development cookbook

By : Ed Musters
Book Image

Microsoft SharePoint 2010 development cookbook

By: Ed Musters

Overview of this book

<p>There is a heavy demand in the marketplace for SharePoint developers that you could take advantage of - if only you had the opportunity to acquire the relevant skills! But, SharePoint 2010 is a big old product with a steep learning curve &ndash; where do you begin? <br /><br />This book has been designed to take the experienced ASP.NET developer from &ldquo;beginner&rdquo; to &ldquo;professional&rdquo; SharePoint developer in the shortest amount of time. You will be productive on you very first SharePoint development assignment with the knowledge and skills that you learn here. You will have distilled the essence of the author&rsquo;s many years of training, and leading development teams in SharePoint. <br /><br />This book uncovers the most common &ldquo;pattern&rdquo; of typical SharePoint development tasks encountered in the real world and puts the topics in a logical order with detailed step-by-step recipes for you to follow. <br />The practical example given builds and flows throughout the chapters and topics. By the end of this book, you will be able to apply the concepts to the challenges ahead of you!</p>
Table of Contents (15 chapters)
Microsoft SharePoint 2010 Development Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

List Event Receivers


A List Event Receiver, simply put is code that you (the developer) can choose to "attach" to one or more lists and that code will (generally) run when either you add, delete, or update items on a list.

List Item Event Receivers are important as they provide you the opportunity to provide some custom error handling or validation logic, and even cancel/prevent the add/update/delete from taking place. The functionality is provided by inheriting from the SPItemEventReceiver class and overriding one of the following key methods :

  • ItemAdded

  • ItemAdding

  • ItemDeleted

  • ItemDeleting

  • ItemUpdated

  • ItemUpdating

You will note from this list the term used – "Before" and "After" events. The before events end in "ing", are trapped before the, say update, takes place, and can be cancelled. The after events end in "ed" and will run after the list has been updated.

Normally, if someone has the ability to add an item to a list, then they will have the ability to delete it. We wish...