Solved

Randomly executes Item.delete for mailitems in Inbox - processing delivery receipts

Posted on 2003-10-22
3
322 Views
Last Modified: 2012-05-04
a)
I have a module (in an access database, but attaches to outlook) that is supposed to process delivery receipts, ultimately to report on end user experience of performance of mail delivery to our various email servers around the world. Mails are automatically sent regularily, with delivery receipt required. Now and again, a module runs from MSaccess that reads all the delivery receipts in the inbox, as this forces the updating of the tracking tab status fields in the sent mail folder.  The first part of the module below searches the inbox for delivery receipts, opens them, and deletes them. This processes the tracking status tab. However it seems to randomly process them. You run it a few times and it gets them all.. but why doesn't it get them all first time?

Set myitems = myfolder.Items.Restrict("[messageclass]='REPORT.IPM.note.DR'")
    For Each Item In myitems
            Item.Display
            Item.Close (olDiscard)
            Item.Delete
    Next

b) Also ... The trackingStatusTime field in the Recipients Object is overwritten by the latest tracking event, so a read receipt would override a delivery receipt. Yet the tracking tab in the sent mail folder shows both read and delivery times, so they must both be stored somewhere. Any idea where I might be able to locate them ?
0
Comment
Question by:brucemcpherson
3 Comments
 

Author Comment

by:brucemcpherson
ID: 9605796
Found the answer to a) on MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnout2k2/html/odc_oldevsol.asp

this now works... you have to go through the collection backwords when deleting..

Set myitems = myfolder.Items.Restrict("[messageclass]='REPORT.IPM.note.DR'")
' becuase deleting an item changes the collection -- you have to go through it backwards
    numitems = myitems.Count
    For i = numitems To 1 Step -1
            Set curItem = myitems(i)
            curItem.Display
            curItem.Close (olDiscard)
            curItem.Delete
    Next
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 10600452
PAQed, with points refunded (125)

GhostMod
Community Support Moderator
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Find out how to use dynamic social media in email signatures with this top 10 DOs & DON’Ts.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now