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,
LastModificatio nTime and DeferredDeliver yTime 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 2 2793
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.co m
<hs****@gmail.c om> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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, LastModificatio nTime and DeferredDeliver yTime 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
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.c om> wrote in message news:11******** **************@ g14g2000cwa.goo glegroups.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, LastModificatio nTime and DeferredDeliver yTime 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: a_geek |
last post by:
Hello,
I'm writing a small program that needs to check Unix timestamps for
falling into an interval (typical usage: ./program 2005-03, you get
the idea). Now, I create two time stamps from the user's input to
create the interval's borders using mktime(). Trying to check the sanity
of my program, I also converted the values back to tuples...
|
by: PK9 |
last post by:
I have a string variable that holds the equivalent of a DateTime value. I
pulled this datetime from the database and I want to strip off the time
portion before displaying to the user.
I am using C#
eg.
- String variable "strMyDate" holds the value "1/1/2005 12:00:00 AM" from
the database.
- I do not care about the time portion, I only...
|
by: Qopit |
last post by:
Hi there,
I'm pretty new to Python and am trying to figure out how to get "will
this code compile?"-like code checking. To me this is a pretty basic
language/environment requirement, especially when working with large
projects. It is *much* better to catch errors at "compile-time" rather
than at run-time.
One thing I've "found" is the...
|
by: rnn98 |
last post by:
hi,
my multithread application, running under solaris box, is crashing
eventually.
I tried to spot and substitute functions not "thread safe", but I
guess my search wasn't good enough. I have put localtime_r and
asctime_r where I was using localtime and asctime. But I didn't find
any correspondent _r function to "time".Also, I found that...
|
by: Micah Williamson |
last post by:
Does anyone know how to make it so that a time entered
as a string, and stored in a string record in an access
2000 database can be kept as a string?
When ever I enter a time like 1:00:00 PM into a bound text
box, then I update the access database, the value changes
to a date with time attached. Access then takes the time
portion away,...
| |
by: John Kelsey |
last post by:
Back in the "old" days with C, I used to do something like...
struct
{
char Description;
float price;
} Items =
{
{"Apple", 1.99},
{"Banana", 2.04}
|
by: rdudejr |
last post by:
Hi all,
Ive got a database approx 350 GB in which Im getting very high Time
waited for prefetch. This is directly out of the snapshot for the db
(these are for the entire database I assume as I pulled it out of get
snapshot for all on {dbname})
Total buffer pool read time (milliseconds) = 45660639
Total buffer pool write time...
|
by: Mike Copeland |
last post by:
How do I mask out all but the _time_ components of a time_t value?
Specifically, I have the following:
time_t wTime = 1226764757;
I happen to know that this is November 16, 2008 @ 8:59:17, but I have
many other such items from which I want to use only the _time_ portion
(e.g. 8:59:17). How do I eliminate the "date" portions of either the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |