Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

vba - Checking if a MailItem is a reply

Given a MailItem, how do I tell if it's a reply to another email?

Alice sends an email to Bob. Bob replies to Alice. When Bob replies, I want to BCC the reply to Charlie. I'm using Application_ItemSend on Bob's machine to do this every time he sends an email to Alice, but I only want to BCC to Charlie when Bob is replying to Alice (not starting a new chain). How can I do that, if possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can check the length of the MailItem.ConversationIndex property - if it is 44 (hex string, 22 bytes for the PR_CONVERSATION_INDEX property), it is a new message, if it is longer than that, it is a reply/forward. See https://msdn.microsoft.com/en-us/library/office/cc765583.aspx?f=255&MSPPError=-2147217396 for more details.

You can also check the subject prefix for RE FW, etc., but the subject can be modified, plus the values are locale specific.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...