H
hsuntn
I am grabbing Outlook MailItems using the Items[] property on my
Outlook inbox. When I iterate through them, I notice that they are
not ordered in ReceivedTime or CreationTime order. For example,
Items[2].ReceivedTime is April 2005
Items[3].ReceivedTime is May 2005
Items[4].ReceivedTime is October 2005
Items[5].ReceivedTime is June 2005
I did some experiments and the following seems to explain how
out-of-order MailItems could happen: assuming I have n items in
my Inbox, if I delete a piece of mail, go to the Trash folder, and
move the just-deleted mail back to the Inbox, the index of the mail
is not its original index, but n. Which makes perfect sense.
The piece of mail was removed from the Items queue, and then
added to the end of the queue, hence its index is the top (n).
All cool with me.
BUT
I need some way to iterate through the emails, stopping when
I reach some date threshold. The reason is, the clients have
HUGE inboxes, like 15,000 emails, and I want to only look at
the ones within the last month. Unfortunately, CreationTime,
LastModificationTime and DeferredDeliveryTime all generally
have the same value as ReceivedTime, which means I can't
just walk my way through Items until I reach something earlier
than last month and then stop (because Items is out-of-order,
hence something from this month might be after that).
Any ideas for how to walk through the Items array, finding just
the items from this month, without searching through all
15,000 emails?
Thanks,
Harold
Outlook inbox. When I iterate through them, I notice that they are
not ordered in ReceivedTime or CreationTime order. For example,
Items[2].ReceivedTime is April 2005
Items[3].ReceivedTime is May 2005
Items[4].ReceivedTime is October 2005
Items[5].ReceivedTime is June 2005
I did some experiments and the following seems to explain how
out-of-order MailItems could happen: assuming I have n items in
my Inbox, if I delete a piece of mail, go to the Trash folder, and
move the just-deleted mail back to the Inbox, the index of the mail
is not its original index, but n. Which makes perfect sense.
The piece of mail was removed from the Items queue, and then
added to the end of the queue, hence its index is the top (n).
All cool with me.
BUT
I need some way to iterate through the emails, stopping when
I reach some date threshold. The reason is, the clients have
HUGE inboxes, like 15,000 emails, and I want to only look at
the ones within the last month. Unfortunately, CreationTime,
LastModificationTime and DeferredDeliveryTime all generally
have the same value as ReceivedTime, which means I can't
just walk my way through Items until I reach something earlier
than last month and then stop (because Items is out-of-order,
hence something from this month might be after that).
Any ideas for how to walk through the Items array, finding just
the items from this month, without searching through all
15,000 emails?
Thanks,
Harold