Skip to content

[29.x] Multiple runs of email retrieval on the same emails don't persist again - #11624

Open
Joshua (mynjj) wants to merge 1 commit into
releases/29.xfrom
bugs/emailmoduledupstorage-29.x
Open

Joshua (mynjj) wants to merge 1 commit into
releases/29.xfrom
bugs/emailmoduledupstorage-29.x

Conversation

@mynjj

@mynjj Joshua (mynjj) commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Backport of #11612.

Fix at the email module layer of the bug causing additional entries to be persisted when retrieving the same email.

If the email had already been retrieved and stored, then such email is returned without further persisting, unless the previous email was stored without attachments, in which case only the attachment is added to such email message.

Tested the behavior against my email inbox locally.

Fix overview

  • The outlook connector first checks if the email had been retrieved before, if so attachments are stored only if requested and they weren't there before.
  • For the outlook connector to make the check if they had been retrieved before, it uses a new centralized FindRetrievedEmail on the email module, with the idea of centralizing this potentially tricky logic and benefitting other connectors.
  • For adding attachments when the email has already been retrieved, a new overload of AddAttachment was needed, since the Modify on the email message that was run after, triggers a subscriber that errors when modifying a received email (rationale of the error is that the system shouldn't modify emails after they have been received, but in this scenario we are not modifying the EmailMessage, but rather adding an attachment and leaving the message as it was, so we don't want this validation to run)

Fixes AB#650461

@mynjj
Joshua (mynjj) requested a review from a team as a code owner September 18, 2026 14:20
@github-actions github-actions Bot added AL: System Application AL: Apps (W1) Add-on apps for W1 Team: Integrations GitHub request for Integrations area labels Sep 18, 2026
@github-actions github-actions Bot added this to the Version 29.1 milestone Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 AL: System Application Team: Integrations GitHub request for Integrations area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants