2

我有一个带有一些 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);
        }  

远程事件接收器创建

    // 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();

RER 已创建(它在我的应用程序下次运行时的调试检查中可用)但 WCF 服务没有捕获任何消息。

我已经检查了 WCF 服务是否可以从托管 Shapoint 站点的网络获得。我不确定用户(用于连接到我的应用程序中的共享点)是否有足够的权限来管理共享点 OOB 列表。

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

4

0 回答 0