View Single Post
  #3  
Old July 23rd 07, 03:52 PM posted to microsoft.public.outlook.program_vba
nana
external usenet poster
 
Posts: 11
Default AdvancedSearch filter with a particular date

Hello Sue,
An additional question with the format of the filter.
In the case below, I will only be able to get a correct result if my filter
has the same date format as set in the local machine, is that true?
I have tried to set my machine format to yyyy-mm-dd but keep the search
criteria as described below, there is an error thrown.
Is there any generic way to set the filter that is independent from the date
format ?
Or do I have to read what the current settings of outlook/windows is before
setting the filter?
Thanks!



"Sue Mosher [MVP-Outlook]" wrote:

Yes, that makes sense. It is unlikely that you have any messages received with a date/time of exactly 27.06.2007 00:00. Try using this filter:

strFilter = "urn:schemas:httpmail:datereceived = '27.06.2007 12:00AM' And urn:schemas:httpmail:datereceived '28.06.2007 12:00AM'"

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"nana" wrote in message ...
Hi,
I am having a problem that if my filter is set to a particular date, my
AdvancedSearch will not return any result.
But if it's set to a range, it is working fine. Is that the normal behavior?
Here is my code.

strScope = "Inbox";
strFilter = "urn:schemas:httpmail:datereceived = '27.06.2007'";
strTag = "Search";
searchResult = OutlookApplication.AdvancedSearch(strScope, strFilter,
'False', strTag);


If the filter is set to

strFilter = "urn:schemas:httpmail:datereceived = '26.06.2007' And
urn:schemas:httpmail:datereceived = '27.06.2007'"

I get the mails of both 26th and 27th of June.
Any idea?



Ads