Determining wether a MailItem is a reply

M

Martijn Reijm

Hi,

I'm building a COM addin for Outlook witch automatically puts a signature
based on database data at the bottom of every message a users sends.

But when a user replies on a message then that signature should not be
appended to the body.

I tried the following:

Private Sub mobjReply_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
Dim objSource As Outlook.MailItem
Dim objProp As Outlook.UserProperty

Set objSource = mobjOutlook.ActiveExplorer.Selection.Item(1)
objSource.UserProperties.Add "Reply", olYesNo
Set objProp = objSource.UserProperties.Find("Reply")
objProp.Value = True

End Sub

Here, mobjReply is the "Reply" button in Outlook.

Then I wanted to scan for the Userproperty but I found out that it's gone
when sending:

Private Sub mobjOutlook_ItemSend(ByVal Item As Object, Cancel As Boolean)
On Error Resume Next
Dim objProp As Outlook.UserProperty
Dim objMailItem As Outlook.MailItem

If Item.Class = olMail Then
Set objMailItem = Item

Set objProp = objMailItem.UserProperties.Find("Reply")
If Not objProp Is Nothing Then '<---------------------------------
It's always Nothing ?!?
If objProp.Value <> True Then
'Voeg de sig toe aan de body van het mailbericht
Item.Body = Item.Body & vbCrLf & vbCrLf & mstrSig
End If
Else
'Voeg de sig toe aan de body van het mailbericht
Item.Body = Item.Body & vbCrLf & vbCrLf & mstrSig
End If
End If
End Sub

Is there a way to determine from the MailItem object wether it is a Relpy of
a New message ??

Thanks in advance, Martijn
 
M

Martijn Reijm

Thanks. Too bad there doesn't seem to be a way to detect it when a message
is a reply....

Martijn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top