Forum Discussion

VivekDreamer's avatar
VivekDreamer
Copper Contributor
Apr 11, 2025

How to get token to fire ews soap request using fetch in exchange onprem setup?

I am currently developing an Outlook add-in for an Exchange On-Premises environment and have encountered a limitation with attachment management, specifically around deleting attachments.

Context:

  1. Environment: Exchange On-Premises (On-Prem)
  2. Target: Outlook Web App (OWA)
  3. Office.js Version Supported: <= 1.5 (limited feature set)

Problem Details:

  1. Limitation of makeEWSRequestAsync:

The makeEWSRequestAsync method in Office.js does not support the DeleteAttachment SOAP operation, which is required for my scenario.

  1. Attempted Workaround - Using fetch with EWS SOAP Request:

I tried invoking the DeleteAttachment operation manually via a fetch call to the EWS endpoint. However, this requires a valid authentication token.

The challenge is: I am unable to retrieve a valid token from Office.js in the Exchange On-Premises setup.
Methods like Office.context.mailbox.getCallbackTokenAsync do not seem to provide usable tokens for this purpose.

  1. OWA Limitation:

As OWA in this environment only supports Office.js up to version 1.5, the modern attachment 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. If direct deletion is not supported in this environment, are there known workarounds or roadmap plans for better attachment handling in on-premises setups?

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