bky
bky

Reputation: 1375

Advanced search with "urn:schemas:httpmail:datereceived" using OR and AND

I'm trying to do an advanced search in Outlook. I use python and win32com to do it.

My query ignores my date filter.

"urn:schemas:mailheader:subject" like '%draft%' OR 
"urn:schemas:mailheader:subject" ci_phrasematch 'draft' OR 
"urn:schemas:httpmail:textdescription" like '%draft%' OR 
"urn:schemas:httpmail:textdescription" ci_phrasematch 'draft' AND 
"urn:schemas:httpmail:datereceived"  > '01.06.2017 12:00 AM'

Upvotes: 1

Views: 6649

Answers (1)

jsotola
jsotola

Reputation: 2278

your query may be working exactly as instructed

i think that you may need to add brackets into your logic statement

your query checks the date only when

("urn:schemas:httpmail:textdescription" ci_phrasematch 'draft') = TRUE

you most likely want this :

    (   ("urn:schemas:mailheader:subject"       like           '%draft%')
     OR ("urn:schemas:mailheader:subject"       ci_phrasematch 'draft'  )
     OR ("urn:schemas:httpmail:textdescription" like           '%draft%')
     OR ("urn:schemas:httpmail:textdescription" ci_phrasematch 'draft'  )
    )
AND ("urn:schemas:httpmail:datereceived"  > '01.06.2017 12:00 AM')

Upvotes: 4

Related Questions