I have recently found out about the Event Receivers' existence and for the past few days I've been trying to solve and old problem: creating an item in 365 as soon as it's created in our internal Sharepoint 2013 Foundation instance.

I have successfully managed to add the item to another internal list, but as soon as I start introducing the ClientContext code, for communicating with 365, the ItemAdded function seems to be ignored and it's no longer being executed. After commenting the ClientContext line that you can see bellow, the function is being accessing without any problem.

public override void ItemAdded(SPItemEventProperties properties)

    SPListItem internalListItem = properties.ListItem;
    cloudContextDev = new ClientContext(_onCloudSiteDev);

I'd like to mention that I have use this command to add the Sharepoint Client:

Install-Package Microsoft.Sharepoint.2013.Client.16

Also, the Sandboxed Solution field is set to False, as due to some server error I haven't been able to use sandboxed solutions. Also, Include Assembly in Package is set to True.

So, my question: Is it any problem in using Sharepoint Client functions in an Event Receiver? Do you have any idea why the function would be ignored instead of throwing me an exception, or anything?

Finally, I haven't tried creating the item through the 365 API yet, and I'd like to stick to CSOM. However, that will be the new thing I'll try.


Your Answer

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

Browse other questions tagged or ask your own question.