Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从C#代码创建SharePoint远程事件接收器_C#_Wcf_Sharepoint_Sharepoint 2013_Event Receiver - Fatal编程技术网

从C#代码创建SharePoint远程事件接收器

从C#代码创建SharePoint远程事件接收器,c#,wcf,sharepoint,sharepoint-2013,event-receiver,C#,Wcf,Sharepoint,Sharepoint 2013,Event Receiver,我有一个sharepoint网站,上面有一些OOB列表(文档和任务)。 我想捕获程序中的列表更改 我试图通过CSOM为此服务创建WCF服务和远程事件接收器(RER),但WCF服务未捕获任何消息 WCF服务和RER是在简单的C#应用程序(控制台应用程序)中创建的 WCF服务的类 public class RemoteEventService : Microsoft.SharePoint.Client.EventReceivers.IRemoteEventService { public v

我有一个sharepoint网站,上面有一些OOB列表(文档和任务)。 我想捕获程序中的列表更改

我试图通过CSOM为此服务创建WCF服务和远程事件接收器(RER),但WCF服务未捕获任何消息

WCF服务和RER是在简单的C#应用程序(控制台应用程序)中创建的

WCF服务的类

public class RemoteEventService : Microsoft.SharePoint.Client.EventReceivers.IRemoteEventService
{
    public void ProcessOneWayEvent(SPRemoteEventProperties properties)
    {
       // some code here
    }


    public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
    {
        SPRemoteEventResult result = null;
        ClientContext context = null;

        // some code here

        return result;
    }
}
WCF服务创建

    using (ServiceHost host = new ServiceHost(typeof(RemoteEventService)))
        {
            host.Open();
            host.Description.Behaviors.Find<ServiceAuthorizationBehavior>().ImpersonateCallerForAllOperations = true;
            Console.WriteLine("Started service at " + host.BaseAddresses[0].ToString());
            Console.WriteLine("Press <enter> to terminate  the Application");
            Console.ReadKey(true);
        }  
RER已创建(在我的应用程序下次运行时的调试检查中可用),但WCF服务未捕获任何消息

我已经检查过,在Shapoint网站所在的网络上是否可以使用WCF服务。 我不确定用户(用于在我的应用程序中连接到sharepoint)是否有足够的权限管理sharepoint OOB列表

是否可以从非sharepoint应用程序将RER添加到sharepoint OOB列表? 如果没有,捕获程序中列表更改的最佳方法是什么

    // check that RER doesn't exist
    EventReceiverDefinitionCreationInformation receiverAdded =
                        new EventReceiverDefinitionCreationInformation();

    receiverAdded.EventType = EventReceiverType.ItemAdded;
    receiverAdded.ReceiverUrl = SERVICE_URL;
    receiverAdded.ReceiverName = "TestDocReceiverAdded";
    receiverAdded.Synchronization = EventReceiverSynchronization.Asynchronous;

    docList.EventReceivers.Add(receiverAdded);
    context.ExecuteQuery();