OfficeDocs-Support icon indicating copy to clipboard operation
OfficeDocs-Support copied to clipboard

Attachments added as shared link files remains in the email body as hyperlink even after manually removing attachment when performing any operation in itemSend event for Outlook

Open avisheknand opened this issue 3 years ago • 0 comments

I am not sure if this is the appropriate place to post issue regarding Outlook , please let me know if this needs to be shifted over to appropriate repo

Problem:

Users may unknowingly send out linked attachments (files are in OneDrive) if they link and then remove the link.

In our testing we found that if

  1. We do anything with the mail item on the ItemSend event and then Cancel Send in the event
  2. User then removes the linked attachment. The UI shows the attachment as removed.
  3. User sends the email out. When you look at the email on the received end, the attachment is available as part of the (HTML) body of the email.

It appears that Linking the attachment adds the attachment as HTML but removing the attachment does not remove the HTML (IF you have done something in the ItemSend event as explained above)

We believe this is VERY RISKY as the sender does not know about this until after it is sent.

Environment

Outlook 365, Online Exchange

How to recreate

  1. Add the following code to your VBA in Outlook.

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) MsgBox Item.Body Cancel = True End Sub

  2. Create a new email

  3. Attach a file from One Drive but choose to attach it as a link

  4. Remove the Linked Attachment. Click Send

  5. You will see in the message (from the item send) that the HTML still exists.

  6. Now MANUALLY go and change the body of the email (just type any word in the body). Click Send

  7. You will see in the message (from the item send) that the HTML now has been corrected.

Check out the video on how to repro it from here : https://customer_resources.s3.us-east-1.amazonaws.com/test/OutlookItemAddEventWithSharedFileLinks.MP4

avisheknand avatar Feb 08 '22 02:02 avisheknand