This repository has been archived by the owner on Mar 11, 2020. It is now read-only.
SharePoint 101 E. Server side dev ~ Lists & Event Receivers
Philippe Lavoie edited this page Mar 11, 2020
·
1 revision
Lists and document libraries are used to store SharePoint content. You can register event receivers to react dynamically to changes in list items.
##List Instances
- Provisionning list instances through XML
- Provisionning list instances programmatically
- This has the benefit of giving you the code hook to manually patch up a list when you want to make it evolve
- Field definitions are copied when a list is created
- List columns are independent from Site columns
- This lets you re-use columns across a site collection, while at the same time giving them a slightly different behavior on each specific list where they are instantiated
- This is painful when you update a site column definition, because you need to manually look through every list that uses this field and patch their corresponding list column
- Localization warning: Lists are accessed programmatically through their Display Name or URL, which will vary depending on the language of your site
##List Templates
- Designing List Templates in Visual Studio
- Field definitions are repeated in the list definition's schema.xml
- A common source of errors
- Why to avoid list definitions when you only need a single list instance
- Hint: as with all XML templates, once you instantiate a list, all subsequent template updated won`t propagate automatically to the existing list instances; you will need to patch all your list instances by hand, i.e. programmatically.
References:
##List Event Receivers
- Synchronous vs. Asynchronous events
- Before (-ing) events vs After (-ed) events
- Example: Adding an event receiver to a list
- Event sequence numbers
References:
- Using Event Receivers in SharePoint Foundation 2010