Description
If the task SendExchangeEmailWithAttachments is given multiple AttachmentFromString attachments, then the first attachment is duplicated.
Steps to reproduce
Call SendExchangeEmailWithAttachments with 2 AttachmentFromString attachments.
Expected behaviour
Each attachment should only appear once in the resulting email.
Notes
This occurs because the allAttachmentFilePaths loop is contained within the attachments loop. Abridged, the code looks like this:
foreach (var attachment in attachments) {
allAttachmentFilePaths.Add(getFilePath(attachment));
foreach (var filePath in allAttachmentFilePaths) {
attachFileToEmail(filePath, email);
}
}
In other words, with 2 attachments, the first iteration of the outer loop attaches the first attachment, and the second iteration attaches the first attachment again and then the second attachment.