Comments (4)
Getting to the folder named 'Undeliverable' is a little bit clunky. You need to do this:
my_folder = None
for k, v in account.folders.items():
for f in v:
if f.name == 'Undeliverable':
my_folder = f
break
if my_folder:
break
assert my_folder
If you already know the folder class of your folder, e.g. Messages
, you can shorten this to:
for f in account.folders[Messages]:
if f.name == 'Undeliverable':
my_folder = f
break
else:
raise Exception('Folder not found')
There should probably be an easier way to do this.
from exchangelib.
I just committed a change so you can do:
my_folder = account.root.get_folder_by_name('Undeliverable')
Change root
to another folder if 'Undeliverable' is not located under root
.
from exchangelib.
for f in account.folders[Messages]:
It would be nice to add
from exchangelib.folders import Messages
(Related to https://stackoverflow.com/q/45935701/562769 )
from exchangelib.
I've thought about this before, but then it would only make sense to import all the other folders types, and that would pollute the top-level import quite a bit. So for this atypical use case I think it's ok to do from exchangelib.folders import Message
.
Anyway, the account.folders
dict feels like a hack. I'd prefer to find a better solution to accessing the folder structure in #110
from exchangelib.
Related Issues (20)
- Create calendar appointment in another account as access data, the appointment is created in the access account. HOT 3
- Get all Public Folders HOT 23
- ErrorInvalidSchemaVersionForMailboxVersion with exchangelib v5.2.1 and Exchange server version 15.2.1544.4 HOT 45
- EOF occurred in violation of protocol HOT 4
- ValueError trying to delete a rule HOT 2
- Error getting folders for v5.2.1+ (server 2010sp3 upd.29) HOT 3
- Cannot fetch calendar folder HOT 4
- Problem getting auth type from Exchange server HOT 15
- The request failed schema validation HOT 9
- Get more than 100 records with a.protocol.resolve_names HOT 1
- EWS does not support returning more than 100 results. See https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/resolvenames-operation
- How to disable check_hostname HOT 5
- some new distinguished folders cause 500 error HOT 4
- Support Custom Authentication Domains for Global and Governmental Environments (gcc-high, dod, etc) HOT 1
- Implement passing an Account object to GetUserAvailability in order to fix the "Returning naive datetime"-warning for timezone-unaware server responses. HOT 3
- Not enough scope error HOT 4
- OOF, The scheduled duration for sending automatic replies isn't valid HOT 4
- 403 Error | App Delegate Access for Personal Outlook Account HOT 5
- Accessing shared calendars does no longer work on 5.4.2 but it does work on 5.2.0 HOT 12
- Calendar items sent to users have reminder as 15 minutes regardless of reminder_is_set set to False HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exchangelib.