Restrict - Sendername, ReceivedTime and Class?

  • Thread starter Thread starter Martin Dirk Los
  • Start date Start date
M

Martin Dirk Los

I have the following code to count the number of inbox
MailItems :
A. excluding the ones from myself (Sendername <> "Los,
Martin Dirk"·);
B. that were received on or after a certain date.

********* begin code ************

strCondition = "[Sendername] <> ""Los, Martin Dirk"" AND
[ReceivedTime] >= ""07/06/2004"""

Set myItems = olNS.GetDefaultFolder(olFolderInbox).Items

Set myRestrictedItems = myItems.Restrict(strCondition)

********* end code ************

1. Will the Resctrict only apply to MailItems
(automatically excluding any confirmation messages)?

2. Will the code still work with confirmation messages
existing in the Inbox?

3. How can I check CLASS TYPE (Outlook help already states
that restrict method doesnt work with class property!!)

TIA

Martin
 
After you get the restricted collection you would have to check the Class
property for each item in the collection to make sure they are mail items as
you handle each one. You might also have better results by And'ing 2
date/time clauses with >= midnight on the date and <= midnight on the next
day.




I have the following code to count the number of inbox
MailItems :
A. excluding the ones from myself (Sendername <> "Los,
Martin Dirk"·);
B. that were received on or after a certain date.

********* begin code ************

strCondition = "[Sendername] <> ""Los, Martin Dirk"" AND
[ReceivedTime] >= ""07/06/2004"""

Set myItems = olNS.GetDefaultFolder(olFolderInbox).Items

Set myRestrictedItems = myItems.Restrict(strCondition)

********* end code ************

1. Will the Resctrict only apply to MailItems
(automatically excluding any confirmation messages)?

2. Will the code still work with confirmation messages
existing in the Inbox?

3. How can I check CLASS TYPE (Outlook help already states
that restrict method doesnt work with class property!!)

TIA

Martin
 
Back
Top