G
Guest
--Outlook 2003 sp2
--VSTO 2005
My goal is to capture the e-mail in the Sent Items folder that was just sent
by the user. If Cache Mode is enabled, I never "get" the e-mail just sent, I
only get the last e-mail to enter the queue. If I remove Cache Mode, it works
like a champ, I get the e-mail just sent by the user. I have added delays,
but nothing works. Here's the code:
.......
Dim loopStartTime As Date = Date.Now
Dim numBeforeSent, numAfterSent As Integer
'objFolder is the Sent folder
numBeforeSent = objFolder.Items.Count
'_thisMail is MailItem
_thisMail.Send()
numAfterSent = objFolder.Items.Count
While Not numAfterSent > numBeforeSent
If DateDiff(DateInterval.Second, loopStartTime, Date.Now) > 30 Then
MsgBox("Unable to continue." & vbCrLf & "Reason: Unable to find the
email in the 'Sent Items' folder.", MsgBoxStyle.Critical)
Exit Function
Else
numAfterSent = objFolder.Items.Count
End If
End While
'''''''ONLY WORKS IN NON-CACHE MODE
sentItem.Item = objFolder.Items.GetFirst
How can I get the latest e-mail delivered to the Sent Items folder if I am
in Cache mode?
--VSTO 2005
My goal is to capture the e-mail in the Sent Items folder that was just sent
by the user. If Cache Mode is enabled, I never "get" the e-mail just sent, I
only get the last e-mail to enter the queue. If I remove Cache Mode, it works
like a champ, I get the e-mail just sent by the user. I have added delays,
but nothing works. Here's the code:
.......
Dim loopStartTime As Date = Date.Now
Dim numBeforeSent, numAfterSent As Integer
'objFolder is the Sent folder
numBeforeSent = objFolder.Items.Count
'_thisMail is MailItem
_thisMail.Send()
numAfterSent = objFolder.Items.Count
While Not numAfterSent > numBeforeSent
If DateDiff(DateInterval.Second, loopStartTime, Date.Now) > 30 Then
MsgBox("Unable to continue." & vbCrLf & "Reason: Unable to find the
email in the 'Sent Items' folder.", MsgBoxStyle.Critical)
Exit Function
Else
numAfterSent = objFolder.Items.Count
End If
End While
'''''''ONLY WORKS IN NON-CACHE MODE
sentItem.Item = objFolder.Items.GetFirst
How can I get the latest e-mail delivered to the Sent Items folder if I am
in Cache mode?