[英]How to create Remote Event receiver for GroupUserAdded event
I have a specific situation where, I need to perform some activity when a new user is added to a SharePoint Group.我有一种特定情况,当新用户添加到 SharePoint 组时,我需要执行一些活动。 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.
我找不到任何可靠的资源来解释如何将 GroupUserAdded 事件类型附加到远程事件接收器。
I know it is possible to attach these event types using the farm solution in SharePoint on premise.我知道可以使用本地 SharePoint 中的场解决方案附加这些事件类型。 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.
但我特别在寻找远程事件接收器,因为我们不想编写场解决方案,而且我们希望将其扩展到 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.问题:无法将与安全相关的事件类型(例如 GroupUserAdded)附加到远程事件接收器 Sharepoint 版本:Sharepoint 2013/2016 和 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.请注意,我能够附加基本的事件类型,例如 ListItemAdded、ListItemUpdated 等。所以我不是在寻找有关如何设置远程事件接收器的一般步骤,但我正在尝试解决一个关于为什么它的特定问题无法将GroupUsersAdded事件类型附加到 Sharepoint Online 或 Sharepoint 2013/2016 中的远程事件接收器。
here's a C# code snippet from my solution which does work (SP Online):这是我的解决方案中的一个 C# 代码片段,它确实有效(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
.只需将处理程序的 url 提供为
url
。 I used an Azure Function for that.为此,我使用了 Azure 函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.