I would like to reply to a mailitem in my inbox with a postitem.
The behavior I'm looking to replicate:
Selecting an email message in the active explorer
Clicking "ctrl + T"
Adding text to the post
Clicking "post"
The resulting postitem contains the e-mail body of the email message replied to, the added text (#3 above) and also takes on the e-mail message's conversationID property, so it appears within the conversation.
I tried:
Sub ReplyToMessage()
' Declare Variables
Dim objItem As Outlook.MailItem
Dim objReply As Outlook.MailItem
' Get the selected message
Set objItem = Application.ActiveExplorer.Selection.Item(1)
' Create a reply message
Set objReply = objItem.Reply
' Set the message class to olPostItem
objReply.MessageClass = "IPM.Post" ' this errors out as
' Add text to the reply message
objReply.Body = "Your reply message goes here."
' Display the reply message
objReply.Display
End Sub
The above creates an e-mail reply, not a post.
I tried creating a new post item and copying the body, subject, etc., but when taking that approach, the post doesn't take on the conversationID of the message I'm replying to, which is critical.
I tried using sendkeys to send "^n", but that runs without response from Outlook.
To summarize: How can I write VBA to replicate what is occurring when "ctrl + T" is pressed with a mailitem selected in the active explorer, creating a postitem that replies in-conversation to a mailitem?
I am running Microsoft Office Professional Plus 2016 (16.0.5387.1000) and it is 64 bit.
You need to convince Outlook to forget about that item