Wilhelm
Wilhelm

Reputation: 21

Outlook Office 365 AddIn: How to get the message text and the incoming message in a reply?

We have implemented an Office 365 AddIn for Outlook that analyzes per click the email text of an incoming message or a new message. Now we want to analyze the text that the user enters in a reply, and for this we need the entered text and (ideally separated) the text of the incoming message. But no function (as we know ) does fit our needs.

The function

this.item.body.getAsync(Office.CoercionType.Text, function cb(asyncResult) {
...

specifies both the reply text and the text of the incoming message in a version that is not reasonable to fit and that is also only "similar" to the original mail.

Example of one result of the this.item.body function getting the reply:

This is a test  <--- this is a reply text
              This is the start of the incoming message
                v
Von: Office 365 Message Center <[email protected]>
Gesendet: Dienstag, 9. April 2019 21:15
An: Wilhelm Vortisch
Betreff: Message Center Major Change Update Notification
...

Try to parse this text "apart" have failed, because this text is not the "original" reply message and our Outlook AddIn can be activated after the user typed in something for the reply.

Upvotes: 2

Views: 889

Answers (1)

Eric Legault
Eric Legault

Reputation: 5834

I think the only feasible solution to this is to parse out the message body to find the reply email's text. You can look for the divRplyFwdMsg DIV and the content will be within that tag.

The only other option is to use the ConversationID with Graph to find the original message in the containing folder, but that would be a bit of a guess to find the email in the thread that was actually replied to (the newest may be the source, but not always).

Upvotes: 1

Related Questions