Solved

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

Posted on 2003-10-22
3
325 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows 7 Professional 6 83
Outlook 2007 email fails to send/recieve intermittently 5 51
Outlook 2010 error message 6 40
Migrating users to new exchange 2010 DB 7 41
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

820 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