简体   繁体   English

Exchangelib - 监视Exchange服务器邮箱,无法连接到共享公用文件夹

[英]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. 我正在尝试使用exchangelib来监视来自专用服务器的电子邮件地址,而无需安装Outlook实例。

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? 是否可以使用exchangelib / python与Exchange服务器上的共享文件夹进行交互? 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. 这不是一个直接的答案,因为它没有在这里使用phyton,但以下可能是你的解决方案,所以我将在这里发布。

You can access a shared folder via the Exchange Webservices (see the Documentation from Microsoft here ). 您可以通过交易所的WebServices(请参阅Microsoft的文档访问共享文件夹位置 )。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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