1

I am playing around with Provider Hosted Apps and Remote Event Receivers to see how everything works. I have a Provider Hosted App set up with the SharePoint component in SharePoint Online, and the web component set up in Azure Websites.

I am using JSOM (not CSOM) on the default.aspx page of the web to read and update a list provisioned to the app web, and that is all working fine.

I've set up event receivers for:

  • ItemAdding
  • ItemAdded
  • ItemUpdating
  • ItemUpdated

I have remote debugging set up so I can see when the events hit the web service. I see the "ings" correctly hit ProcessEvent() and the "eds" correctly hit ProcessOneWayEvent().

The problem is, the BeforeProperties is always empty. Now I can understand that BeforeProperties might be empty for something like ItemAdding, because at that point there was no "before", but shouldn't there be both BeforeProperties and AfterProperties for ItemUpdating and/or ItemUpdated?

Anyone have any thoughts as to why this is happening?

  • Me too facing same issue. RemoteEventProperties.ItemEventProperties.BeforeProperties is empty in ItemUpdating for CustomList. Is this issue still hanging around ? Anyone familiar with workarounds to make this work ? – Srinivasa Rao Magupalli Jul 20 '17 at 9:07
2

You can remember that

  • BeforeProperties and AfterProperties are different for Sync. and Async. events

  • BeforeProperties and AfterProperties behavior is different for List Items and Library Items

  • If you investigate and test BeforeProperties and AfterProperties behavior in these cases - be ready that it could be all broken if you use Publishing template site

Check for beggining this table of values, but test independently in Your environment

  • 1
    Aha, so according to that table, BeforeProperties is only ever used on Document Libraries, it is never populated with data for regular lists, and I am using a custom list. So I will never see BeforeProperties. – Dylan Cristy Mar 10 '15 at 15:07
  • NB - the table linked to suggests using properties.ListItem to get at some of the values (like original values for regular list items), however, for SP2013 remote events, there is no ListItem property on the SPRemoteEventProperties object. So it looks like for remote event receivers there is no way to find "before" properties for a list item, and no workaround. msdn.microsoft.com/EN-US/library/office/… – Dylan Cristy Mar 23 '15 at 19:18
  • In some events ListItem could be used, in others(example Adding) - there is no ListItem object at all yet(it is not constructed yet, You will know it's Id and properties later in "Added" event), so properties.AfterProperties["field"] is used instead. – Gennady G Mar 23 '15 at 20:31
  • I don't think you understood my point. In the SPItemEventProperties class, there is a property ListItem. Yes, maybe in some situations it will be null. However, in the SPRemoteItemEventProperties class, there is no property for ListItem. So for remote event receivers, there is no workaround to get to that information. – Dylan Cristy Mar 23 '15 at 20:39
  • Yes, but You still have properties.Before/AfterProperties or properties.ItemEventProperties.Before/AfterProperties? If doesn't help then imho You should store or get the listItem object especially inside Your request – Gennady G Mar 24 '15 at 5:30

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.