ecederstrand / exchangelib

Python client for Microsoft Exchange Web Services (EWS)
BSD 2-Clause "Simplified" License
1.17k stars 250 forks source link

Delegate: root.tree vs. msg_folder_root.tree #433

Closed deathbywedgie closed 6 years ago

deathbywedgie commented 6 years ago

When accessing an Exchange 2013 mailbox as a delegate (credentials for user1, delegate access to mailbox for user2), in msg_folder_root.tree I see the folders for user2 (as expected), yet inside of "Top of Information Store" in root.tree I see the folders of user1's own mailbox. Is this expected behavior? I would think that both would reflect user2's mailbox.

In the example below, note the subfolders "Reviewed" and "test," which exist in the mailbox of user1 but are not present in the mailbox for user2.

account.root.tree()

>>> print(account.root.tree())
root
├── AllItems
├── Common Views
├── Deferred Action
├── ExchangeSyncData
├── Finder
├── Freebusy Data
├── Recoverable Items
│   ├── Deletions
│   ├── Purges
│   └── Versions
├── Schedule
├── Sharing
├── Shortcuts
├── Spooler Queue
├── System
├── Top of Information Store
│   ├── Calendar
│   ├── Contacts
│   ├── Conversation Action Settings
│   ├── Deleted Items
│   ├── Drafts
│   ├── Inbox
│   │   ├── Reviewed
│   │   └── test
│   ├── Journal
│   ├── Junk E-Mail
│   ├── Notes
│   ├── Outbox
│   ├── Quick Step Settings
│   ├── Sent Items
│   ├── Suggested Contacts
│   ├── Sync Issues
│   │   ├── Conflicts
│   │   ├── Local Failures
│   │   └── Server Failures
│   └── Tasks
├── Transport Queue
└── Views

account.msg_folder_root.tree()

>>> print(account.msg_folder_root.tree())
Top of Information Store
├── Calendar
├── Contacts
├── Deleted Items
├── Drafts
├── Inbox
├── Journal
├── Junk E-Mail
├── Notes
├── Outbox
├── Sent Items
└── Tasks
>>> 
deathbywedgie commented 6 years ago

I should add that I am also troubleshooting an issue wherein new folders aren't showing up in msg_folder_root either, but I can't tell yet if this is related. They can be seen when opened in Outlook as user1 or any of multiple other users with access to the shared mailbox, but exchangelib doesn't see the folder in msg_folder_root.

ecederstrand commented 6 years ago

Which exchangelib version is this? 1.11.4 fixed a bug in this area. The only folder now where we don't explicitly add the account when fetching a folder is PublicFoldersRoot where Exchange throws an error if we do. See: https://github.com/ecederstrand/exchangelib/blob/8adaee98f6227aa0de199a362d8bb9c96e51cf57/exchangelib/folders.py#L56

deathbywedgie commented 6 years ago

@ecederstrand You are right; during the time that I have been troubleshooting the issue, you have once again found and addressed the issue. I was on 1.11.3 and confirmed it was the latest when I started developing the newest code; 1.11.4 did resolve both issues (the main post and the one I referenced in my comment above).

Thanks!