Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2005

Tip: Looking for answers? Try searching our database.

outlook items "addition time"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hsuntn@gmail.com - 21 Nov 2005 20:52 GMT
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
Sue Mosher [MVP-Outlook] - 21 Nov 2005 20:55 GMT
Have you considered using either Items.Sort or Items.Restrict?

Signature

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

>I am grabbing Outlook MailItems using the Items[] property on my
> Outlook inbox.  When I iterate through them, I notice that they are
[quoted text clipped - 32 lines]
> Thanks,
> Harold
Nicholas Paldino [.NET/C# MVP] - 21 Nov 2005 21:07 GMT
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.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

>I am grabbing Outlook MailItems using the Items[] property on my
> Outlook inbox.  When I iterate through them, I notice that they are
[quoted text clipped - 32 lines]
> Thanks,
> Harold

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.