简体   繁体   中英

Filter EWS mailbox by recipient address using exchangelib

I'm writing a monitoring solution using python3 with exchangelib and trying to count messages in our team's mailbox. One of the criteria: recipient list must contain specific email address .

When i use filter() with author or subject arguments script is working fine and return correct results.

But when i tried to filter by to_recipients or to_recipients__contains (which is list-type field), script throws an exception:

ValueError: EWS does not support filtering on field 'to_recipients'

Is there a way to filter mailbox by recipient email_address , avoiding to fetch all messages and than filtering it on the client side?

[exchangelib maintainer here]

I don't think there is. You could try to flip the is_searchable flag on that field and search anyway, but I never could get filtering to work in my tests. I can't remember if it throws server errors, returns all items anyway, or returns an empty list.

I'm happy to accept patches it you do find a solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM