Restrict - Sendername, ReceivedTime and Class?

  • Thread starter Martin Dirk Los
  • 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
 
K

Ken Slovak - [MVP - Outlook]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top