'Retrieving all Outlook messages in same thread
We are building sort of Communication Management System atop Outlook. One of the important task we wish to achieve is to retrieve all the messages (.msg files??) in the same thread along with their attachments and put them in the same folder inside CMS's repository .
The problem we are facing is how do we know programatically that particular message (or .msg file??) and attachment belongs to the particular thread.
Say for a first message we create a folder in a repository. Then we want all the messages (along with attachments) sent as a reply to the original message to go automatically in the same folder.
I tried to find if their is any header set in .msg file to identify the thread, but did not found anything.
But still curious how the Outlook client can show the messages arranged as communication thread hierarchy. So there must be some way that we can retrieve this information stored somewhere. I just want to know how can I access it.
Solution 1:[1]
The grouped conservation are indicated in the message header: "Message-ID: ", "References: " & "In-Reply-To: ", you can view it with Outlook VBA with below function I found previously.
Private Function GetInetHeaders(olkMsg As Outlook.MailItem) As String
' Purpose: Returns the internet headers of a message.'
' Written: 4/28/2009'
' Author: BlueDevilFan'
' Outlook: 2007'
Const PR_TRANSPORT_MESSAGE_HEADERS = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"
Dim olkPA As Outlook.PropertyAccessor
Set olkPA = olkMsg.PropertyAccessor
GetInetHeaders = olkPA.GetProperty(PR_TRANSPORT_MESSAGE_HEADERS)
Set olkPA = Nothing
End Function
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | PatricK |
