Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How can we attach a remote event receiver to a SharePoint online (office 365) site using CSOM in console app?

$
0
0

Hi,

I am developing a console application in which I have to attach a remote event receiver to a SharePoint online site. However, remote event receiver has been deployed using SharePoint provider hosted app on azure site, and it is up and running.

I am able to attach that RER to the site successfully through console app but RER is not triggering when I do any activity related to that event.

Refer below code for attaching the RER:

Site RootSite = clientContext.Site;
clientContext.Load(RootSite, pSite => pSite.EventReceivers);
clientContext.ExecuteQuery();

EventReceiverDefinitionCreationInformation eventReceiverInfo = new EventReceiverDefinitionCreationInformation();
eventReceiverInfo.EventType = EventReceiverType.WebProvisioned;
eventReceiverInfo.ReceiverClass = "WebProvisionedEvent";
eventReceiverInfo.ReceiverName = "WebProvisionedEvent";
eventReceiverInfo.ReceiverUrl = "https://test.azurewebsites.net/Services/WebProvisionedEvent.svc";
eventReceiverInfo.SequenceNumber = 10001;
eventReceiverInfo.ReceiverAssembly = AssemblyFullName;
RootSite.EventReceivers.Add(eventReceiverInfo);
clientContext.ExecuteQuery();

Any help would be appreciable...

Thanks,



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>