SPSecurityEventReceiver class

Provides methods to trap security-related events at the site or site collection level. To create a custom event receiver class you must derive from this class and overrides the methods.

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.SPEventReceiverBase
    Microsoft.SharePoint.SPSecurityEventReceiver

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Class SPSecurityEventReceiver _
    Inherits SPEventReceiverBase
'Usage
Dim instance As SPSecurityEventReceiver
public class SPSecurityEventReceiver : SPEventReceiverBase

Remarks

The class provides methods to trap events in five main categories: group events, user events, inheritance events, role assignment events, and role definition events. All of the class methods can be used at both the site and site collection level except the role definition events, which can only be used at the site level. None can be attached to list objects.

As mentioned, there are five categories of events:

Group events

Group events fire when you add, update, or delete groups from the master groups list at the site or site collection levels. Can be used at both the site collection (SPSite) and site (SPWeb) levels.

  • GroupAdded

  • GroupAdding

  • GroupDeleted

  • GroupDeleting

  • GroupUpdated

  • GroupUpdating

User events

User Events fire when you add or delete a SharePoint user or SharePoint group or Active Directory (AD) user or AD security group from an existing SharePoint group. Can be used at both the site collection (SPSite) and site (SPWeb) levels.

  • GroupUserAdded

  • GroupUserAdding

  • GroupUserDeleted

  • GroupUserDeleting

Inheritance events

Inheritance Events fire when you break inheritance or reset inheritance (re-inherit) on lists, libraries, sites, and so forth. Can be used at both the site collection (SPSite) and site (SPWeb) levels.

  • InheritanceBreaking

  • InheritanceBroken

  • InheritanceReset

  • InheritanceResetting

Role assignment events

Role assignment events fire once inheritance is broken and you add or delete users or groups using the Permissions page for the associated site or list. Can be used at both the site collection (SPSite) and site (SPWeb) levels.

  • RoleAssignmentAdded

  • RoleAssignmentAdding

  • RoleAssignmentDeleted

  • RoleAssignmentDeleting

Role definition events

Role definition events fire when you add, update, or delete role definitions. These events can only be attached at the site collection (SPSite) level.

  • RoleDefinitionAdded

  • RoleDefinitionAdding

  • RoleDefinitionDeleted

  • RoleDefinitionDeleting

  • RoleDefinitionUpdated

  • RoleDefinitionUpdating

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See also

Reference

SPSecurityEventReceiver members

Microsoft.SharePoint namespace

Other resources

Tim Ferro (blog)