1

I want to set a custom header in Outlook outgoing mail using an Outlook Web Add-in. How can we achieve this?

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
Rajeev
  • 4,762
  • 8
  • 41
  • 63

4 Answers4

3

While Mark's (@MarkLaFleur) answer is correct and indeed the Office.js API doesn't provide any direct functionality to manipulate with transport layer headers, you are able to achieve this. There are two options available for you ...

UPDATE:

With Mailbox 1.8 API set new Office.InternetHeaders interface is available to set, get and remove Transport Headers of the message through regular JavaScript API calls.

Slava Ivanov
  • 6,666
  • 2
  • 23
  • 34
  • One known caveat in this approach though is that in desktop outlook cached mode, until the new mail draft is synced to the server, the ID you get from item saveAsync API will not work with makeEwsRequestAsync because the server does not know about the new item yet.. – Oleg O - MSFT Aug 11 '17 at 01:36
  • @OlegO-MSFT Yes, this is the issue investigated by me more than year ago through Microsoft professional support as described in [EWS request failed with item Id returned by item.saveAsync on compose new message](https://social.msdn.microsoft.com/Forums/en-US/6a7417d1-8af8-453f-bce0-584b7f79b0c1/app-for-outlook-ews-request-failed-with-item-id-returned-by-itemsaveasync-on-compose-new-message?forum=appsforoffice). Unfortunately closed as "won't fix". – Slava Ivanov Aug 22 '17 at 14:53
1

I assume you mean "custom" header. This isn't possible to do from an add-in. Add-ins only extend the UX, they have no hooks into the underlying transport pipeline.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
0

The header cannot be customized by outlook js api. In which scenario, is it required? Thanks

  • x-headers are widely used by content scanning, archiving providers as well as any application which needs to set into the message information user should not see, but will be important to this app to process this message with server-side solutions when traveled through Internet. Microsoft uses x-headers as well. If we able to set message property via Office.js API, why we are not able to set the property which will be preserved when message leave Exchange environment (x-header)? – Slava Ivanov Aug 22 '17 at 15:03
  • This is interesting, but our api still currently doesn't support it. Requests/Reasons for new features should be suggested at: https://officespdev.uservoice.com/ for consideration. – Outlook Add-ins Team - MSFT Aug 23 '17 at 17:49
  • I am aware the API currently does not support it. As of my communication with Office Dev team, I am strongly believe this task is on the back log of requested features for quiet a while. We are not the only one who would like to have it. Big players would want it as well. Thank you for suggestion. – Slava Ivanov Aug 23 '17 at 19:10
  • 1
    Thanks, I followed up with some people on the team, and can confirm that this is on the backlog of features that is highly requested, but cannot comment on the timeline for that feature. – Outlook Add-ins Team - MSFT Aug 24 '17 at 20:18
0

The header will not persist as each mail client behaves different. So there is no guarantee that your customer headers will be sent back. But if you want to map the received email with the one which you sent. You can use the header :References. Every received email will contain the same even when the sender changed the email sub.

A_01
  • 1,021
  • 11
  • 27