How custom event receivers affect OnePlaceMail upload process
Article describes inconsistent upload issues and ways of fixing them.
Issue
Library event receivers may affect the OnePlaceMail uploading process resulting in inconsistent errors.
Scenario 1
File has been modified error. There could be several problematic emails in the upload results window, but some of them are uploaded successfully:
Scenario 2
Metadata was not populated. Some of the email messages left without email properties updated after uploading several emails:
Reason
OnePlaceMail uploads an email message in several steps and some of them include the following events:
- ItemAdding - when msg or other file type is uploaded into library this event is triggered - occurs before added
- ItemAdded - when msg or other file type is uploaded into library this event is triggered - occurs after added
- ItemUpdating - we get the item again in library and apply the metadata to item so this event is triggered - occurs before metadata applied
- ItemUpdated - we get the item again in library and apply the metadata to item so this event is triggered - occurs after metadata applied
Any custom code written in these event handlers could cause an issue.
Library event receivers have one of the two synchronization types either Asynchronous or Synchronous.
Asynchronous event receivers are executed after committing the file to the database, thus it could happen before 3rd step of OnePlaceMail process (which leads to the error "The file has been modified"