SharePoint Short #2
In event receivers such as ListAdded, FieldAdded or ItemAdded, if you’re updating the newly created item you may encounter the following error:
“Save Conflict”
These events are asynchronous by default, so changing them to synchronous will ensure that the list, item or field has been added before the event fires. When it’s set to asynchronous, there a high possibility that the item has not completely finished adding when the event is fired, hence the save conflict error.
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Receivers > <Receiver> <Name>CustomFieldAdded</Name> <Type>FieldAdded</Type> <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly> <Class>Custom.FieldAdded</Class> <SequenceNumber>10000</SequenceNumber> <Synchronization>Synchronous</Synchronization> </Receiver> </Receivers> </Elements> |