I do receive a lot of mails sent by various robots. I can identify Emails easily by subject (for example: \"Response to ticket 123\"). Unfortunately each email is generated aut
This is not a complete answer, but it is too long for a comment.
I was able to set the MAPI conversationTopic and conversationIndex properties using the tips here and the code:
oItem.propertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/proptag/0x00710102", _
oItem2.propertyAccessor.GetProperty("http://www.slipstick.com/developer/read-mapi-properties-exposed-outlooks-object-model/")
for the ConversationIndex property, for example. This assumes that you have one message as oItem and the other as oItem2, both declared as Objects. Note that this property is binary, and so if you want to look at it you can use:
oItem2.propertyAccessor.BinaryToString(x)
where x represents the property (set to a variable or just put the propertyAccessor.GetProperty code in there). This becomes relevant because the ConversationID of the message object is the last bunch of "characters/binary bits" of the MAPI ConversationIndex property. However, changing the ConversationIndex property DID NOT change the ConversationID.
Both the ConversationIndex and conversationTopic properties of the message object are read-only, however changing the conversationTopic MAPI property DID change the ConversationTopic property of the message. I was unable to get this to actually group the messages, however.
My research suggested that the ConversationTopic property should be the one that initially groups the messages, with the ConversationIndex property sorting them after the grouping, but, as I mentioned, I was unable to get the messages to group, even after assigning the same ConversationTopic to both MAPI and the message object.
Here's code that helps show this behavior:
Dim Msg As Outlook.MailItem
Dim oItem As Object
Dim oItem2 As Object
Dim objNS As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
Dim Item As Object
Set objNS = GetNamespace("MAPI")
Set olFolder = objNS.GetDefaultFolder(olFolderInbox)
For Each Item In olFolder.Items
If TypeName(Item) = "MailItem" Then
Debug.Print "Subject: " & Item.Subject & " " & Item.propertyAccessor.BinaryToString(Item.propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x00710102"))
If Item.Subject = "test" Then
Set oItem = Item
ElseIf Item.Subject = "test2" Then
Set oItem2 = Item
End If
End If
Next Item
Debug.Print "OItem: " & vbCr _
& "ConversationIndex: " & oItem.ConversationIndex & vbCr _
& "ConversationID: " & oItem.ConversationID & vbCr _
& "ConversationTopic: " & oItem.ConversationTopic & vbCr _
& "MAPI ConversationIndex: " & oItem.propertyAccessor.BinaryToString(oItem.propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x00710102")) & vbCr _
& "MAPI ConversationTopic: " & oItem.propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0070001E") & vbCr
Debug.Print "OItem2: " & vbCr _
& "ConversationIndex: " & oItem2.ConversationIndex & vbCr _
& "ConversationID: " & oItem2.ConversationID & vbCr _
& "ConversationTopic: " & oItem2.ConversationTopic & vbCr _
& "MAPI ConversationIndex: " & oItem2.propertyAccessor.BinaryToString(oItem2.propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x00710102")) & vbCr _
& "MAPI ConversationTopic: " & oItem2.propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0070001E") & vbCr
Debug.Print "Set OItem2 To OItem"
oItem2.propertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/proptag/0x0070001E", oItem.ConversationTopic
oItem2.propertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/proptag/0x00710102", oItem.propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x00710102")
Debug.Print "OItem: " & vbCr _
& "ConversationIndex: " & oItem.ConversationIndex & vbCr _
& "ConversationID: " & oItem.ConversationID & vbCr _
& "ConversationTopic: " & oItem.ConversationTopic & vbCr _
& "MAPI ConversationIndex: " & oItem.propertyAccessor.BinaryToString(oItem.propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x00710102")) & vbCr _
& "MAPI ConversationTopic: " & oItem.propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0070001E") & vbCr
Debug.Print "OItem2: " & vbCr _
& "ConversationIndex: " & oItem2.ConversationIndex & vbCr _
& "ConversationID: " & oItem2.ConversationID & vbCr _
& "ConversationTopic: " & oItem2.ConversationTopic & vbCr _
& "MAPI ConversationIndex: " & oItem2.propertyAccessor.BinaryToString(oItem2.propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x00710102")) & vbCr _
& "MAPI ConversationTopic: " & oItem2.propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0070001E") & vbCr
Sharing this in case it helps anyone solve the problem.