Change Content Type order triggger eventreceiver

%3CLINGO-SUB%20id%3D%22lingo-sub-1501054%22%20slang%3D%22en-US%22%3EChange%20Content%20Type%20order%20triggger%20eventreceiver%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1501054%22%20slang%3D%22en-US%22%3E%3CP%3EOn%20a%20SharePoint%20Online%20list%20we%20have%20several%20remote%20event%20receivers.%3C%2FP%3E%3CP%3EOne%20of%20them%20is%20a%20synchronous%20ItemUpdating%20event%20receiver.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20changing%20Content%20Type%20order%20or%20visibility%20this%20event%20receiver%20is%20triggered%20with%20ItemEventProperties.ListItemId%20%3D%200%3C%2FP%3E%3CP%3EIn%20our%20event%20receiver%20we're%20cancelling%20the%20event%20because%20the%20ListItemId%20is%200%20(it%20does%20not%20make%20sense%20to%20execute%20a%20event%20receiver%20on%20ListItemId%200%20as%20it%20doesn't%20exist).%3C%2FP%3E%3CP%3EBecause%20we%20cancel%20the%20event%20the%20reorder%20of%20content%20type%20is%20also%20cancelled.%3C%2FP%3E%3CP%3EWe%20can%20workaround%20it%20by%20letting%20the%20event%20receiver%20complete%2C%20but%20why%20does%20SharePoint%20trigger%20event%20receivers%20when%20changing%20content%20type%20order%2Fvisibility%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1501054%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ELists%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Senior Member

On a SharePoint Online list we have several remote event receivers.

One of them is a synchronous ItemUpdating event receiver.

 

When changing Content Type order or visibility this event receiver is triggered with ItemEventProperties.ListItemId = 0

In our event receiver we're cancelling the event because the ListItemId is 0 (it does not make sense to execute a event receiver on ListItemId 0 as it doesn't exist).

Because we cancel the event the reorder of content type is also cancelled.

We can workaround it by letting the event receiver complete, but why does SharePoint trigger event receivers when changing content type order/visibility?

 

0 Replies