Reputation: 748
using Anaconda2-5.0.0-Windows-x86_64, Python2.7, exchangelib 1.10.4
I am trying to save attachments from all emails from an exchange account. It seems I can connect to the account without problem but everytime I try to run through the process, it gives me an error message. Here is the code which I have tried :
mailbox = account.inbox
for msg in mailbox.all():
for attachment in msg.attachments:
fpath = os.path.join(r'C:\temp', attachment.name)
with open(fpath, 'wb') as f:
f.write(attachment.content)
The error I am getting is :
The 'FieldURI' attribute is invalid - The value 'item:IsAssociated' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.
The messages on that inbox contain CSV file attachments and the mailbox currently has 23 messages stored.
Upvotes: 2
Views: 4392
Reputation: 10220
This was a bug in exchangelib when connecting to Exchange 2007 servers. Fixed in https://github.com/ecederstrand/exchangelib/commit/8561bd0f3e6bfd7c8d01bc57cbcc3dca3cf33fc4 and https://github.com/ecederstrand/exchangelib/commit/3609fa23e403821bdc5f80cd896a9df1d73f0275
Upvotes: 2