Forum Discussion

Kapil's avatar
Kapil
Copper Contributor
Apr 13, 2025

How to Delete a Composing Email Attachment via Outlook Add-in?

Context:

  • Server: Exchange Server 2019 on premise
  • Client: OWA
  • Category: Outlook Add-in
  • Office JS API Set: Supported up to 1.5 only

Problem Details:

Delete an attachment added manually or through EWS API to an email item.

Limitations:

1. Limitation of makeEWSRequestAsync() Office JS method:

The makeEWSRequestAsync method in Office.js does not support the DeleteAttachment SOAP operation, which is required from outlook add in.

-> Attempted Workaround - Using fetch with EWS SOAP Request:

I tried invoking the DeleteAttachment operation via a fetch call to the EWS endpoint. However, EWS response states "requested web method is not allowed for this application".

2. OWA Limitation:

As OWA in this environment only supports Office.js up to version 1.5, the modern attachment Office JS APIs and Graph APIs are not an option.

Question:

  1. In an Exchange On-Premises scenario, how can I programmatically delete attachments via my add-in?
  2. Specifically, is there a recommended approach to obtain a valid token for EWS requests, or any supported alternative to perform DeleteAttachment?
  3. Any way to convert EWS attachment ID to Office JS attachment UUID?

Additional Notes:

I am aware that Exchange Online supports more modern APIs (Graph/REST), but my current deployment is strictly Exchange On-Premises.

The add-in works well for reading attachments and other operations, except for deletion.

Any guidance or recommendations would be highly appreciated!

Thank you in advance.

No RepliesBe the first to reply

Resources