Search code examples
outlookms-officeadd-inoutlook-addinoffice-js

Email thread detection in an Outlook add-in?


I'm designing an Outlook add-in and need to determine whether a selected message is part of a thread. Ideally, I'd also like to find related messages in said thread as well. Reading over the documentation, the conversationId property looks promising, though there doesn't seem to be a way to "get messages by conversationId."

Under the current version (1.4, non-preview) of the Outlook Add-in API, is it possible to detect that a message is part of a thread using the JavaScript API? Is it possible to then find other messages in the same thread?


Solution

    • ConversationId is part of the javascript API. This means that you can know the ConversationId for the Office.context.mailbox.item whose your add-in is focusing on. See documentation here

    • To my knowledge, there is no way to retrieve all mails for a given ConversationId using vanilla javascript and Office.js.

    However, you may be interested in my answer here.

    When something is not available with Office.js api for an Outlook Add-in you can try to use the Exchange Web Services (EWS) or REST APIs to perform the action

    You have basically two ways to request EWS from a mail add-in.

    For the specific case of retrieving conversations using the Outlook REST API, this answer may also be helpful.