简体   繁体   中英

Exchangelib - Monitoring an exchange server mailbox, cannot connect to shared public folder

I am trying to use exchangelib in order to monitor an e-mail address from a dedicated server without requiring an instance of Outlook be installed.

import exchangelib
from exchangelib import DELEGATE, Account, Credentials, IMPERSONATION
from exchangelib.configuration import Configuration



credentials = Credentials(
    username='TFAYD\\206420055',
    password='boomboomboomboom'
)

config = Configuration(server='ecmail.test.com', credentials=credentials)

account = Account(
    primary_smtp_address='test.test@nbcuni.com',
    config=config,
    autodiscover=False,
    access_type=DELEGATE,
)
#print(account.folders)
#t = account.root.get_folder_by_name('\\\\Public Folders - test.test@nbcuni.com\\All Public Folders\\test\\test\\NEWS')

z = account.folders
print([t for t in z])

I've tried a few different things in order to get to a public folder that my account has access to but it continuously complains that there is no such folder with that name.

Is it possible to use exchangelib / python to interact with shared folder on exchange server? I am hoping to watch the folder with an automated process.

Its not a direct answer as it didn´t use phyton here, but the following might be the solution for you, so I will post it here.

You can access a shared folder via the Exchange Webservices (see the Documentation from Microsoft here ).

And here is a working example.

To access folders of other accounts you have access to, just connect to that account:

other_account = Account(
    primary_smtp_address='some.other.account@nbcuni.com',
    config=config,
    autodiscover=False,
    access_type=DELEGATE,
)
other_calendar = other_account.calendar

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