Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

SPEventReceiverDefinitionCollection class

Represents a collection of SPEventReceiverDefinition objects that are used to enumerate the list of registered event receivers for Microsoft SharePoint Foundation objects that can have events.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
[ClientCallableTypeAttribute(Name = "EventReceiverDefinitionCollection", ServerTypeId = "{8AEF5B03-F05E-46e9-9537-6C3AAD574B7A}", 
	CollectionChildItemType = typeof(SPEventReceiverDefinition), CollectionCreateEntityMethodClientName = "Create", 
	CollectionIndexerMethodClientName = "GetById", SampleUrl = "{apiroot}/web/eventreceivers")]
public class SPEventReceiverDefinitionCollection : SPBaseCollection

Use the EventReceivers property of the SPContentType, SPFile, SPList, SPListItem, SPWeb, or SPWorkflow class to get the collection of event receivers that are registered for the SharePoint Foundation object.

To create an event receiver definition, use one of the Add methods of the SPEventReceiverDefinitionCollection class.

Use an indexer to return a single event receiver definition from the collection. For example, assuming that the collection is assigned to a variable named myEventReceiverDefinitions, use myEventReceiverDefinitions[index] in C#, or myEventReceiverDefinitions(index) in Visual Basic .NET, where index is either the index number of the definition in the collection or the GUID of the definition.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.