Retrieving all Outlook messages in same thread

风流意气都作罢 提交于 2019-12-10 11:46:17

问题


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.


回答1:


Use PR_CONVERSATION_INDEX property (you can see it in OutlookSpy if you click the IMessage button)
Conversation tracking is documented on MSDN: http://msdn.microsoft.com/en-us/library/office/cc765583.aspx




回答2:


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


来源:https://stackoverflow.com/questions/18350338/retrieving-all-outlook-messages-in-same-thread

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!