467,893 Members | 1,905 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,893 developers. It's quick & easy.

outlook items "addition time"

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

Nov 21 '05 #1
  • viewed: 2488
Share:
2 Replies
Harold,

Have you checked the Sort property on the Items collection? It will
allow you to sort the list by a certain field.

Also, you might want to consider using the Find and FindNext methods on
the Items collection, as they will iterate from the current item through the
list, and find the items that correspond to the criteria that you specify.

I mention the Find and the FindNext methods because if you do a sort
operation, you are going to have to iterate through the list somehow in
order to sort the items in the first place. If you are going to do that,
then iterate through some number of items to determine which ones are
applicable, you might as well just iterate through the whole list once with
Find and FindNext.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<hs****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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

Nov 21 '05 #2
Have you considered using either Items.Sort or Items.Restrict?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
<hs****@gmail.com> wrote in message news:11**********************@g14g2000cwa.googlegr oups.com...
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

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by a_geek | last post: by
22 posts views Thread by Qopit | last post: by
2 posts views Thread by Micah Williamson | last post: by
3 posts views Thread by rdudejr | last post: by
4 posts views Thread by Mike Copeland | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.