Requirement
I have a requirement, where I have to call a plugin on pre-validation whenever an email attachment (Activitymimeattachment) is created.
Problem
I have already completed the business logic and as expected, whenever I create an email attachment against an email, the plugin gets triggered and the business logic works. But that only happens when I create attachments myself on the email one by one. When an email is received into the system with attachments, the Create message on Activitymimeattachment does not get triggered.
Is there any other message that gets triggered when email is received into the system, maybe to create multiple attachments at once? For example, when I open a attachment, Retrieve message is called, but when email is sent out, the inner implementation calls RetrieveMultiple to retrieve and send all the attachments. Similary, I saw a message CreateMultiple, but that is not allowed on Activitymimeattachment.
Any help to identify the message or trigger, using which, I can intercept the attachments before they are created with incoming emails, will be great. Thank you.