0
我需要訪問組織中所有O365用戶的任務文件夾。爲此,我使用Exchanged Web服務(EWS)。我能夠訪問我自己的任務文件夾以及與我共享的文件夾,但我需要訪問它們。Exchange Web Service(EWS):如何訪問組織中的所有用戶任務文件夾
我需要一種方法來強制每個帳戶與我共享他們的任務文件夾來完成我想要做的事情(我不能要求組織中的每個人都自己做,它會變得複雜,因爲有約400名用戶)。
有沒有我可以授予我自己作爲管理員的權限,以避免共享文件夾或我可以運行的腳本會爲我執行此任務?
這裏是我到目前爲止的代碼:
from exchangelib import DELEGATE, IMPERSONATION, Account, Credentials, ServiceAccount, \
EWSDateTime, EWSTimeZone, Configuration, NTLM, CalendarItem, Message, \
Mailbox, Attendee, Q, ExtendedProperty, FileAttachment, ItemAttachment, \
HTMLBody, Build, Version
import json
credentials = Credentials(username='[email protected]', password='password')
config = Configuration(server='outlook.office365.com' , credentials=credentials)
account = Account(primary_smtp_address='[email protected]', credentials=credentials, config=config,
autodiscover=False, access_type=DELEGATE)
all_tasks = []
json_tasks = []
for t in account.tasks.all():
all_tasks.append(t)
for t in all_tasks:
data = {"Action" : t.subject, "actualWork": t.actual_work, "Project": t.billing_information, "Status": t.status, "Owner": t.owner, "isComplete": t.is_complete}
json_data = json.dumps(data)
print(json_data)
print(account.tasks.total_count)