1

Following is my code to have webprovisioned event receiver but nothing happened, it seems it is not firing at all.

the AppEventReceiver file

EventReceiverDefinitionCreationInformation eventReceiverProvisioned = new EventReceiverDefinitionCreationInformation()
{
     EventType = EventReceiverType.WebProvisioned,
     ReceiverName = "MyRerWebProvisioned",
     ReceiverUrl = "https://temp.azurewebsites.com/Services/MyRer.svc",
     SequenceNumber = 10000,
     Synchronization = EventReceiverSynchronization.Synchronous,
     ReceiverAssembly = System.Reflection.Assembly.GetExecutingAssembly().FullName,
     ReceiverClass = "MyRer"                            
};
clientContext.Site.EventReceivers.Add(eventReceiverProvisioned);
clientContext.ExecuteQuery();

the MyRer.svc.cs

using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
{
    if (clientContext != null)
    {
       if (properties.EventType == SPRemoteEventType.ItemUpdating)
       {
           var rootWeb = clientContext.Web;
           clientContext.Load(rootWeb);
           clientContext.ExecuteQuery();

           //Adding an item to a list for testing purpose
       }
    }
}

but nothing happened. thanks and appreciate any kind of advice.

0

First of all, your Event Receiver EventType is EventReceiverType.WebProvisioned when your RER is not checking for that.

It is checking for SPRemoteEventType.ItemUpdating. Change the EventType comparison to SPRemoteEventType.WebProvisioned

I'd be interested to know if this WebProvisioned event receiver works however so let me know how you get on!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.