PC Review


Reply
Thread Tools Rate Thread

Determining wether a MailItem is a reply

 
 
Martijn Reijm
Guest
Posts: n/a
 
      17th Dec 2003
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



 
Reply With Quote
 
 
 
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      17th Dec 2003
You must save the message after adding/changing a property (objSource.Save).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Martijn Reijm @tdn.nl>" <mreijm<nospam> wrote in message
news:3fe03311$0$38785$(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
Martijn Reijm
Guest
Posts: n/a
 
      18th Dec 2003
Thanks. Too bad there doesn't seem to be a way to detect it when a message
is a reply....

Martijn

"Dmitry Streblechenko" <(E-Mail Removed)> schreef in bericht
news:#mk$(E-Mail Removed)...
> You must save the message after adding/changing a property

(objSource.Save).
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Martijn Reijm @tdn.nl>" <mreijm<nospam> wrote in message
> news:3fe03311$0$38785$(E-Mail Removed)...
> > 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
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MailItem object has no property for when a reply was sent mmoore Microsoft Outlook VBA Programming 3 14th Dec 2009 12:16 AM
Trap the MailItem.Reply Event Naji Microsoft Outlook Form Programming 1 10th Apr 2008 03:00 PM
Creating mailitem with reply/reply to all/forward buttons =?Utf-8?B?Y2hyaXNs?= Microsoft Outlook Form Programming 3 21st Jun 2007 11:55 PM
Determining if a MailItem was sent or received Codex Microsoft Outlook Program Addins 1 10th Feb 2004 12:27 AM
Determining wether a form is maximised minimised or restored jag Microsoft Access VBA Modules 3 10th Sep 2003 01:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:00 AM.