Question often asked but not fully answered

M

Martin Teefy

Hi,

I'm using a free com dll from MAPILab in VB6 to get the extended properties of emails bypassing the outlook warning message but i'm having trouble getting the read/unread/replied status

As I said a frequent question but there doesn't seem to be a good answer as i've spent all afternoon reading the answers/questions to build up the following code but i'm obviously missing something...

Code is:

Private Const cdoPR_ICON_INDEX As Long = &H10800003
Private Const cdoPR_LAST_VERB_EXECUTED As Long = &H10810003
Private Const cdoPR_LAST_VERB_EXECUTION_TIME As Long = &H10820040

Private Const EXCHIVERB_REPLYTOSENDER = 102
Private Const EXCHIVERB_REPLYTOALL = 103
Private Const EXCHIVERB_FORWARD = 104

Set objProps = CreateObject("Mapiprop.MAPIPropWrapper")
objProps.Initialize

Set olApp = New Outlook.Application
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olFolder = olNameSpace.GetDefaultFolder(olFolderInbox)

Set objItem = olFolder.Items.GetLast ' GetFirst

' PR_SENDER_NAME + PR_SENDER_EMAIL_ADDRESS
from_text.Text = objProps.getoneprop(objItem, CdoPR_SENDER_NAME) + " <" + objProps.getoneprop(objItem, CdoPR_SENDER_EMAIL_ADDRESS) + ">"
size_text.Text = objProps.getoneprop(objItem, CdoPR_MESSAGE_SIZE)
subject_text.Text = objProps.getoneprop(objItem, CdoPR_SUBJECT)
sent_text.Text = objProps.getoneprop(objItem, CdoPR_MESSAGE_DELIVERY_TIME)

If IsDate(objProps.getoneprop(objItem, CdoPR_LAST_MODIFICATION_TIME)) Then

Select Case IIf(IsEmpty(objProps.getoneprop(objItem, cdoPR_LAST_VERB_EXECUTED)), 101, objProps.getoneprop(objItem, cdoPR_LAST_VERB_EXECUTED))
Case 101
.CellDetails iRow, 1, , , 4 ' Read Icon
Case 102 ' Replied to
.CellDetails iRow, 1, , , 3 ' Reply Icon
Case 103 ' Replied to All
.CellDetails iRow, 1, , , 3 ' Reply Icon
Case 104 ' Forwarded to
.CellDetails iRow, 1, , , 2 ' Forward Icon
Case Else
.CellDetails iRow, 1, , , 1 ' Unread
End Select


End If

but the objProps.getoneprop(objItem, cdoPR_LAST_VERB_EXECUTED) step always give an automation error am I missing something?

Any advice appreciated.

Thanks
Martin
 
S

Sue Mosher [MVP]

One thing you might be missing is that the property in question is not going
to be present on every item. Only items that have had an action executed on
them will have that property. Your code must handle the error that will
occur if it tries to access a property that is not present.
 

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