1

I have a specific situation where, I need to perform some activity when a new user is added to a SharePoint Group. I am trying to achieve this by using Remote event receivers but i am unsuccessful so far. I couldn't find any reliable resources explaining how the GroupUserAdded event type can be attached to the Remote event receiver.

I know it is possible to attach these event types using the farm solution in SharePoint on premise. but i am specifically looking for Remote event receivers as we don't want to write a farm solution and also we want to extend this to SharePoint online.

Problem : Unable to attach Security related Event types such as GroupUserAdded to Remote event receivers Sharepoint versions : Sharepoint 2013/2016 and Sharepoint Online.

Please note that, I am able to attach the basic event types such as ListItemAdded,ListItemUpdated etc. So i am not looking for a general steps about how to setup a Remote event receivers, but i am trying to solve a specific issue about why it is not possible to attach GroupUsersAdded event type to the Remote event receivers in Sharepoint Online or Sharepoint 2013/2016.

1 Answers1

0

here's a C# code snippet from my solution which does work (SP Online):

            var eventReceiverUserAdded =
                new EventReceiverDefinitionCreationInformation
                {
                    EventType = EventReceiverType.GroupUserAdded,
                    ReceiverName = "GroupMembershipChanged",      // can be anything
                    ReceiverUrl = url,                            // supply your own
                    SequenceNumber = 1000
                };

            web.EventReceivers.Add(eventReceiverUserAdded);
            web.Context.ExecuteQuery();

Just supply the url of your handler as url. I used an Azure Function for that.

ceperaK
  • 21
  • 3