In this article you will see how to create a GroupAdded event receiver in SharePoint 2013.
Introduction
An event receiver is a custom code that is called when a triggering action such as adding, updating, deleting, moving, checking in, and checking out occurs on a specified SharePoint object such as site collections, sites, lists, and workflows. SharePoint 2013 introduced a new event receiver class called "SPSecurityEventReceiver". The custom event receiver class must derive from "SPSecurityEventReceiver" (Please refer to: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurityeventreceiver.roleassignmentadded.aspx). In this article we will see how to create group added event receiver in SharePoint 2013. I have created a custom list called "Group Details". When a new group is added to the site a new item will be created in "Group Details" that will specify the group name, user login name and created date and time.
Create Empty SharePoint Project
- Open Visual Studio 2012 (Run as administrator).
- Go to "File" => "New" => "Project...".
- Select "SharePoint 2013 Project" template from the installed templates.
- Enter the name "GroupAddedEventReceiver" and then click on Ok.

Figure 1: New Project template
- Select the site and security level for debugging.

Figure 2: Specify the site and security level for debugging - Click on Finish.
Add Feature to the project
- In the Solution Explorer, right-click on the Features folder.
- Click on "Add Feature".
- Rename Feature1 to "GroupAddedFeature".
- Double-click on GroupAddedFeature and specify the Title & Description.

Figure 3: GroupAddedFeature
Add Event Receiver to the Feature
Feature Events receivers are methods that execute when one of the following feature-related events occur in SharePoint:
- A feature is installed
- A feature is activated
- A feature is deactivated
- A feature is removed
Please refer to http://msdn.microsoft.com/en-us/library/ee231604.aspx to Add Feature Event Receivers. When a feature is activated please use members of the SPEventReceiverDefinition class to register a GroupAdded event receiver.
- In the Solution Explorer, right-click on GroupAddedFeature.
- Click on Add Event Receiver.
- Double-click on "GroupAddedFeature.EventReceiver.cs".
- Replace the code with the following:
using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Microsoft.SharePoint;
using System.Reflection;
namespace GroupAddedEventReceiver.Features.GroupAddedFeature
{
/// <summary>
/// This class handles events raised during feature activation, deactivation, installation, uninstallation, and upgrade.
/// </summary>
/// <remarks>
/// The GUID attached to this class may be used during packaging and should not be modified.
/// </remarks>
[Guid("624a8f45-4aa5-402f-9f05-4c41ce3a6215")]
public class GroupAddedFeatureEventReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWeb web = properties.Feature.Parent as SPWeb;








Suganya NatarajPosted Jan 31, 2017, 8:12 AM
Hi, Am trying to track GroupDeleting Event. And am not able to get the group name which is getting deleted through properties.GroupName. its showing null. Any idea how to get the GroupName ???